diff mbox

[1/2] USB: musb-gadget: fix bulk IN infinite hangs in double buffer case

Message ID AANLkTimcRHayXoVr8UaOrDV0F_cD6owW06fSBGpEXc8L@mail.gmail.com (mailing list archive)
State New, archived
Delegated to: Felipe Balbi
Headers show

Commit Message

Ming Lei Aug. 28, 2010, 2:51 a.m. UTC
None
diff mbox

Patch

diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index e898228..1cf6d28 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -503,14 +503,14 @@  void musb_g_tx(struct musb *musb, u8 epnum)
 				request->zero = 0;
 			}

-			/* ... or if not, then complete it. */
-			musb_g_giveback(musb_ep, request, 0);
-
-			request = musb_ep->desc ? next_request(musb_ep) : NULL;
-			if (!request) {
-				DBG(4, "%s idle now\n",
-					musb_ep->end_point.name);
-				return;
+			if (request->actual == request->length) {
+				musb_g_giveback(musb_ep, request, 0);
+				request = musb_ep->desc ? next_request(musb_ep) : NULL;
+				if (!request) {
+					DBG(4, "%s idle now\n",
+						musb_ep->end_point.name);
+					return;
+				}
 			}
 		}