All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/2] usb: gadget: fastboot: Request status and length check in rx handler
@ 2015-07-04 14:46 Paul Kocialkowski
  2015-07-04 14:46 ` [U-Boot] [PATCH 2/2] usb: gadget: fastboot: Dequeue the previous IN request for the current request Paul Kocialkowski
                   ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: Paul Kocialkowski @ 2015-07-04 14:46 UTC (permalink / raw)
  To: u-boot

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 | 11 ++++++-----
 1 file 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);
 }
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2019-03-18 17:20 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-04 14:46 [U-Boot] [PATCH 1/2] usb: gadget: fastboot: Request status and length check in rx handler Paul Kocialkowski
2015-07-04 14:46 ` [U-Boot] [PATCH 2/2] usb: gadget: fastboot: Dequeue the previous IN request for the current request Paul Kocialkowski
2015-07-06 10:35   ` Lukasz Majewski
2019-03-18  9:56   ` [U-Boot] Subject Eugeniu Rosca
2019-03-18 10:12     ` Paul Kocialkowski
2019-03-18 17:15       ` Eugeniu Rosca
2019-03-18 17:20         ` [U-Boot] [U-Boot, 2/2] usb: gadget: fastboot: Dequeue the previous IN request for the current request Eugeniu Rosca
2019-03-18 12:32     ` [U-Boot] Subject Marek Vasut
2015-07-06 10:28 ` [U-Boot] [PATCH 1/2] usb: gadget: fastboot: Request status and length check in rx handler Lukasz Majewski
2015-07-06 12:08   ` Paul Kocialkowski
2015-07-06 13:03   ` Paul Kocialkowski
2015-07-14 10:22 ` Lukasz Majewski
2015-07-14 10:27   ` Paul Kocialkowski
2015-07-14 11:32     ` Lukasz Majewski
2015-07-15 13:53       ` Paul Kocialkowski
2015-07-20  9:57 ` Lukasz Majewski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.