usb: dwc3: gadget: Check for in-progress END_TRANSFER
authorThinh Nguyen <Thinh.Nguyen@synopsys.com>
Wed, 6 May 2020 02:46:33 +0000 (19:46 -0700)
committerFelipe Balbi <balbi@kernel.org>
Mon, 25 May 2020 08:09:41 +0000 (11:09 +0300)
While handling TRBs completion, if a END_TRANSFER command isn't
completed, don't kick new transfer or issue END_TRANSFER command.

Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
drivers/usb/dwc3/gadget.c

index 865e6fbb7360221c7fe28e09f8bc54c4e4d00a0c..3bb6f847a8656f656cf2151c008050ef1b035d96 100644 (file)
@@ -2675,11 +2675,15 @@ static void dwc3_gadget_endpoint_transfer_in_progress(struct dwc3_ep *dep,
 
        dwc3_gadget_ep_cleanup_completed_requests(dep, event, status);
 
+       if (dep->flags & DWC3_EP_END_TRANSFER_PENDING)
+               goto out;
+
        if (stop)
                dwc3_stop_active_transfer(dep, true, true);
        else if (dwc3_gadget_ep_should_continue(dep))
                __dwc3_gadget_kick_transfer(dep);
 
+out:
        /*
         * WORKAROUND: This is the 2nd half of U1/U2 -> U0 workaround.
         * See dwc3_gadget_linksts_change_interrupt() for 1st half.