]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
greybus: hid: fix success response being sent on errors
authorJohan Hovold <johan@hovoldconsulting.com>
Fri, 27 Mar 2015 11:45:45 +0000 (12:45 +0100)
committerGreg Kroah-Hartman <greg@kroah.com>
Mon, 30 Mar 2015 13:17:37 +0000 (15:17 +0200)
Make sure to only send a success response if we did not detect any
errors.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/staging/greybus/hid.c

index 9734c7b35cc21ff12764b86de0f22ecb4977bf97..f0da387476b877096a2185f843a2eb18f1081f34 100644 (file)
@@ -163,13 +163,6 @@ static void gb_hid_irq_handler(u8 type, struct gb_operation *op)
                return;
        }
 
-       ret = gb_operation_response_send(op, 0);
-       if (ret) {
-               dev_err(&connection->dev,
-                       "failed to send response status %d: %d\n",
-                       0, ret);
-       }
-
        size = request->report[0] | request->report[1] << 8;
        if (!size) {
                dev_err(&connection->dev, "bad report size: %d\n", size);
@@ -179,6 +172,13 @@ static void gb_hid_irq_handler(u8 type, struct gb_operation *op)
        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);
+       if (ret) {
+               dev_err(&connection->dev,
+                       "failed to send response status %d: %d\n",
+                       0, ret);
+       }
 }