diff mbox series

[v2,4/4] usb: dwc3: gadget: WARN on no-resource status

Message ID 1538b1dfe07cb3fee30acbc8a21e44678032c088.1585523081.git.thinhn@synopsys.com (mailing list archive)
State Mainlined
Commit f7ac582effc6ee416eb51e0c3e55836aaf7231ac
Headers show
Series usb: dwc3: gadget: Improve isoc starting mechanism | expand

Commit Message

Thinh Nguyen March 29, 2020, 11:13 p.m. UTC
If the driver issued START_TRANSFER and received a no-resource status,
then generally there are a few reasons for this:

1) The driver did not allocate resource for the endpoint during
power-on-reset initialization.

2) The transfer resource was reset. At this moment, we don't do this in
the driver, but it occurs when the driver issues START_CONFIG cmd to ep0
with resource index=2.

3) The driver issues the START_TRANSFER command to an already started
endpoint. Usually, this is because the END_TRANSFER command hasn't
completed yet.

Print out a warning to help debug this issue in the driver.

Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
---
 drivers/usb/dwc3/gadget.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index ee87b7b383f6..1a4fc03742aa 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -356,6 +356,8 @@  int dwc3_send_gadget_ep_cmd(struct dwc3_ep *dep, unsigned cmd,
 				ret = 0;
 				break;
 			case DEPEVT_TRANSFER_NO_RESOURCE:
+				dev_WARN(dwc->dev, "No resource for %s\n",
+					 dep->name);
 				ret = -EINVAL;
 				break;
 			case DEPEVT_TRANSFER_BUS_EXPIRY: