]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
usb: gadget: fastboot: Request status and length check in rx handler
authorPaul Kocialkowski <contact@paulk.fr>
Sat, 4 Jul 2015 14:46:15 +0000 (16:46 +0200)
committerLothar Waßmann <LW@KARO-electronics.de>
Wed, 9 Sep 2015 11:49:00 +0000 (13:49 +0200)
This avoids handling requests that have an error status or no data.
In particular, this avoids showing unnecessary error messages when the USB
gadget gets disconnected (e.g. with fastboot continue) and the fastboot USB
gadget driver sends an error back to the host (that has disconnected already).

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
drivers/usb/gadget/f_fastboot.c

index 206b6d17aea610ccb8ef0b8cec6c66ed241b2d4d..b9a909986b733edc27eed753059d5ab3e2d3248b 100644 (file)
@@ -635,6 +635,9 @@ static void rx_handler_command(struct usb_ep *ep, struct usb_request *req)
        void (*func_cb)(struct usb_ep *ep, struct usb_request *req) = NULL;
        int i;
 
+       if (req->status != 0 || req->length == 0)
+               return;
+
        for (i = 0; i < ARRAY_SIZE(cmd_dispatch_info); i++) {
                if (!strcmp_l1(cmd_dispatch_info[i].cmd, cmdbuf)) {
                        func_cb = cmd_dispatch_info[i].cb;
@@ -656,9 +659,7 @@ static void rx_handler_command(struct usb_ep *ep, struct usb_request *req)
                }
        }
 
-       if (req->status == 0) {
-               *cmdbuf = '\0';
-               req->actual = 0;
-               usb_ep_queue(ep, req, 0);
-       }
+       *cmdbuf = '\0';
+       req->actual = 0;
+       usb_ep_queue(ep, req, 0);
 }