usb: dwc3: ep0: giveback requests on stall_and_restart
authorFelipe Balbi <balbi@ti.com>
Thu, 8 Sep 2011 15:17:12 +0000 (18:17 +0300)
committerFelipe Balbi <balbi@ti.com>
Fri, 9 Sep 2011 10:05:28 +0000 (13:05 +0300)
if we don't, the list will be busy forever.

Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/dwc3/ep0.c

index 48d3770bd7652452a4f18cfebf6ee0215932b2c1..4cc72fdc0575b7d955c94170018073e57555c44c 100644 (file)
@@ -214,9 +214,19 @@ out:
 
 static void dwc3_ep0_stall_and_restart(struct dwc3 *dwc)
 {
+       struct dwc3_ep          *dep = dwc->eps[0];
+
        /* stall is always issued on EP0 */
        __dwc3_gadget_ep_set_halt(dwc->eps[0], 1);
        dwc->eps[0]->flags = DWC3_EP_ENABLED;
+
+       if (!list_empty(&dep->request_list)) {
+               struct dwc3_request     *req;
+
+               req = next_request(&dep->request_list);
+               dwc3_gadget_giveback(dep, req, -ECONNRESET);
+       }
+
        dwc->ep0state = EP0_SETUP_PHASE;
        dwc3_ep0_out_start(dwc);
 }