diff options
author | Johan Hovold <johan@hovoldconsulting.com> | 2015-03-27 12:45:48 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <greg@kroah.com> | 2015-03-30 15:20:33 +0200 |
commit | d0eb755aeef092f27b3dd2a4c90616f613541f56 (patch) | |
tree | 33f75aab223896744f5d0a4803641e042dc6033d /drivers/staging/greybus/hid.c | |
parent | 382145beb4a4bb057f17d5b411546b6b56fbacd1 (diff) |
greybus: hid: fix missing response on request errors
Send response also to incoming requests that cannot be fulfilled.
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Diffstat (limited to 'drivers/staging/greybus/hid.c')
-rw-r--r-- | drivers/staging/greybus/hid.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/staging/greybus/hid.c b/drivers/staging/greybus/hid.c index 8e32dfcd1131..cc5708ddf068 100644 --- a/drivers/staging/greybus/hid.c +++ b/drivers/staging/greybus/hid.c @@ -155,17 +155,20 @@ static void gb_hid_irq_handler(u8 type, struct gb_operation *op) struct gb_connection *connection = op->connection; struct gb_hid *ghid = connection->private; struct gb_hid_input_report_request *request = op->request->payload; + int status; int ret, size; if (type != GB_HID_TYPE_IRQ_EVENT) { dev_err(&connection->dev, "unsupported unsolicited request\n"); - return; + status = -EINVAL; + goto send_response; } if (op->request->payload_size < 2) { dev_err(&connection->dev, "short report received\n"); - return; + status = -EINVAL; + goto send_response; } /* @@ -175,18 +178,21 @@ static void gb_hid_irq_handler(u8 type, struct gb_operation *op) size = request->report[0] | request->report[1] << 8; if (size < 2 || size > op->request->payload_size - 2) { dev_err(&connection->dev, "bad report size: %d\n", size); - return; + status = -EINVAL; + goto send_response; } if (test_bit(GB_HID_STARTED, &ghid->flags)) hid_input_report(ghid->hid, HID_INPUT_REPORT, request->report + 2, size - 2, 1); - ret = gb_operation_response_send(op, 0); + status = 0; +send_response: + ret = gb_operation_response_send(op, status); if (ret) { dev_err(&connection->dev, "failed to send response status %d: %d\n", - 0, ret); + status, ret); } } |