[PATCH] usb: dwc3: Do not handle xfercomplete if EP is already stopped

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In some rare cases, we have observed that core generates xfercomplete
event for last transfer even when "end transfer" was issued for that
endpoint.

Now since we have already called the giveback for the submitted request,
so we do not need to handle this interrupt at all.

Signed-off-by: Pratyush Anand <pratyush.anand@xxxxxx>
Reported-by: Michel Sanches <michel.sanches@xxxxxx>
---
 drivers/usb/dwc3/gadget.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index bb9b184..3cc5057 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1802,14 +1802,20 @@ static void dwc3_endpoint_interrupt(struct dwc3 *dwc,
 
 	switch (event->endpoint_event) {
 	case DWC3_DEPEVT_XFERCOMPLETE:
-		dep->resource_index = 0;
-
 		if (usb_endpoint_xfer_isoc(dep->endpoint.desc)) {
 			dev_dbg(dwc->dev, "%s is an Isochronous endpoint\n",
 					dep->name);
 			return;
 		}
 
+		if (!dep->resource_index) {
+			dev_dbg(dwc->dev, "%s has already been stopped\n",
+					dep->name);
+			return;
+		}
+
+		dep->resource_index = 0;
+
 		dwc3_endpoint_transfer_complete(dwc, dep, event, 1);
 		break;
 	case DWC3_DEPEVT_XFERINPROGRESS:
-- 
1.7.5.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux