The DWC3_EP_PENDING_REQUEST flag is set against an endpoint when there are no pending or started requests available. This flag is cleared on queuing to the endpoint for endpoint 0, but not for any other endpoints. This can exacerbate timing problems by allowing a queue to go ahead for an isochronous endpoint that should not be started, so clear the flag upon a successful dwc3_gadget_ep_queue(). Signed-off-by: Daniel Scally <dan.scally@xxxxxxxxxxxxxxxx> --- drivers/usb/dwc3/gadget.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 578804dc29ca..bc1d93c56d82 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -1988,13 +1988,17 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req) */ if (usb_endpoint_xfer_isoc(dep->endpoint.desc)) { if (!(dep->flags & DWC3_EP_TRANSFER_STARTED)) { + int ret = 0; + if ((dep->flags & DWC3_EP_PENDING_REQUEST)) - return __dwc3_gadget_start_isoc(dep); + ret = __dwc3_gadget_start_isoc(dep); - return 0; + dep->flags &= ~DWC3_EP_PENDING_REQUEST; + return ret; } } + dep->flags &= ~DWC3_EP_PENDING_REQUEST; __dwc3_gadget_kick_transfer(dep); return 0; -- 2.34.1