summary refs log tree commit diff
diff options
context:
space:
mode:
authorJohn Youn <John.Youn@synopsys.com>2015-12-22 12:23:20 -0800
committerFelipe Balbi <balbi@ti.com>2015-12-22 21:58:26 -0600
commitd9261898a4b2c143c28568dc686a1becfc637a99 (patch)
tree36926864944efeff0392a0005a452c7336579f69
parent746bfe63bba37ad55956b7377c9af494e7e28929 (diff)
downloadlinux-d9261898a4b2c143c28568dc686a1becfc637a99.tar.gz
usb: dwc3: gadget: don't send extra ZLP
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.

Fixes: 04c03d10e507 ("usb: dwc3: gadget: handle request->zero")
Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r--drivers/usb/dwc3/gadget.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 64b2a8303d33..af023a81a0b0 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);