If the request->length is zero, a ZLP should already be sent due to that
and another ZLP is not needed to terminate the transfer.

Signed-off-by: John Youn <[email protected]>
---
 drivers/usb/dwc3/gadget.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 64b2a83..af023a8 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1203,7 +1203,8 @@ static int dwc3_gadget_ep_queue(struct usb_ep *ep, struct 
usb_request *request,
         * extra usb_request ourselves so that it gets handled the same way as
         * any other request.
         */
-       if (ret == 0 && request->zero && (request->length % ep->maxpacket == 0))
+       if (ret == 0 && request->zero && request->length &&
+           (request->length % ep->maxpacket == 0))
                ret = __dwc3_gadget_ep_queue_zlp(dwc, dep);
 
        spin_unlock_irqrestore(&dwc->lock, flags);
-- 
2.6.3

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to