]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
usb: dwc3: gadget: check for empty started_list after cleaning completed requests
authorAnurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Mon, 15 Apr 2019 15:32:32 +0000 (15:32 +0000)
committerMichal Simek <michal.simek@xilinx.com>
Tue, 16 Apr 2019 09:34:51 +0000 (11:34 +0200)
The code in dwc3_gadget_endpoint_transfer_in_progress() checks for
the empty value in started_list before cleaning up the complted
requests. Since the present working request is not yet cleaned from
started_list, the list_empty(started_list) always returns non-empty.
This patch corrects the code by moving the list_empty(started_list)
check after calling dwc3_gadget_ep_cleanup_completed_requests()

Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/usb/dwc3/gadget.c

index 72b8fa3a471560cb26d6d3e2de140fa0501e3fae..e9fa36d9ebfe5c131b7ff7b592ec36799515670c 100644 (file)
@@ -2486,18 +2486,18 @@ static void dwc3_gadget_endpoint_transfer_in_progress(struct dwc3_ep *dep,
                status = -ECONNRESET;
 
        if ((event->status & DEPEVT_STATUS_MISSED_ISOC) &&
-           usb_endpoint_xfer_isoc(dep->endpoint.desc)) {
+           usb_endpoint_xfer_isoc(dep->endpoint.desc))
                status = -EXDEV;
 
-               if (list_empty(&dep->started_list))
-                       stop = true;
-       }
-
        dwc3_gadget_ep_cleanup_completed_requests(dep, event, status);
 
        if (dep->stream_capable && !list_empty(&dep->started_list))
                __dwc3_gadget_kick_transfer(dep);
 
+       if (usb_endpoint_xfer_isoc(dep->endpoint.desc) &&
+           list_empty(&dep->started_list))
+               stop = true;
+
        if (stop) {
                dwc3_stop_active_transfer(dep, true);
                dep->flags = DWC3_EP_ENABLED;