diff options
author | Paul Kocialkowski <contact@paulk.fr> | 2015-07-04 16:46:15 +0200 |
---|---|---|
committer | Marek Vasut <marex@denx.de> | 2015-07-22 08:57:54 +0200 |
commit | 94b385fa236c85b00ee0bceced05aad2550c2208 (patch) | |
tree | 07dfb83729084c10242afed65d681ce03eb46dbf /drivers/usb/gadget | |
parent | eca76b7429cedb600d724f6f1655bc43ede811a8 (diff) | |
download | u-boot-imx-94b385fa236c85b00ee0bceced05aad2550c2208.zip u-boot-imx-94b385fa236c85b00ee0bceced05aad2550c2208.tar.gz u-boot-imx-94b385fa236c85b00ee0bceced05aad2550c2208.tar.bz2 |
usb: gadget: fastboot: Request status and length check in rx handler
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>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r-- | drivers/usb/gadget/f_fastboot.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c index 206b6d1..b9a9099 100644 --- a/drivers/usb/gadget/f_fastboot.c +++ b/drivers/usb/gadget/f_fastboot.c @@ -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); } |