diff mbox series

[2/4] usb: dwc3: gadget: don't use resource_index as a flag

Message ID 20190124072501.15100-2-felipe.balbi@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series [1/4] usb: dwc3: gadget: clear DWC3_EP_TRANSFER_STARTED on cmd complete | expand

Commit Message

Felipe Balbi Jan. 24, 2019, 7:24 a.m. UTC
We have a proper flag for testing that we have a valid transfer in
flight, let's use that instead.

This patch is in preparation to fix a rare race condition that happens
upon Disconnect Interrupt.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
---
 drivers/usb/dwc3/gadget.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index a3903b8dc11e..f0320fcfdaf4 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -2619,8 +2619,8 @@  static void dwc3_stop_active_transfer(struct dwc3_ep *dep, bool force)
 	u32 cmd;
 	int ret;
 
-	if ((dep->flags & DWC3_EP_END_TRANSFER_PENDING) ||
-	    !dep->resource_index)
+	if (dep->flags & DWC3_EP_END_TRANSFER_PENDING)
+		|| !(dep->flags & DWC3_EP_TRANSFER_STARTED))
 		return;
 
 	/*