[PATCH] usb: dwc3: gadget: Add the suspend state checking when stopping gadget
From: Baolin Wang
Date: Fri Jun 17 2016 - 06:38:46 EST
It will be crash to stop gadget when the dwc3 device had been into suspend
state, thus we need to check if the dwc3 device had been into suspend state
when UDC try to stop gadget.
By the way I have rebased on your 'testing/next' branch.
Signed-off-by: Baolin Wang <baolin.wang@xxxxxxxxxx>
---
drivers/usb/dwc3/gadget.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 6dde376..351769e 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1791,6 +1791,9 @@ err0:
static void __dwc3_gadget_stop(struct dwc3 *dwc)
{
+ if (pm_runtime_suspended(dwc->dev))
+ return;
+
dwc3_gadget_disable_irq(dwc);
__dwc3_gadget_ep_disable(dwc->eps[0]);
__dwc3_gadget_ep_disable(dwc->eps[1]);
--
1.7.9.5