From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lukasz Majewski Date: Mon, 06 Jul 2015 12:28:40 +0200 Subject: [U-Boot] [PATCH 1/2] usb: gadget: fastboot: Request status and length check in rx handler In-Reply-To: <1436021176-15701-1-git-send-email-contact@paulk.fr> References: <1436021176-15701-1-git-send-email-contact@paulk.fr> Message-ID: <20150706122840.20ac66e2@amdc2363> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Paul, > 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 > --- > 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); > } Reviewed-by: Lukasz Majewski Let's wait for some more time before pulling this patch to u-boot-dfu tree. I hope that other fastboot users will also review this patch. -- Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group