From 336d33b9386b195103f9ec173155b7799327a4c9 Mon Sep 17 00:00:00 2001 From: Udipto Goswami Date: Wed, 7 Jul 2021 18:46:13 +0530 Subject: [PATCH] usb: dwc3: Perform pm_runtime async op for suspend in ep_disable The ep_disable functions uses pm_runtime_get_sync & pm_runtime_put_sync_autosuspend to manage the dev & sysdev, however doing auto suspend in sync context might lead to errors on runtime framework due to the ASYNC flag not set. When this happens, the runtime framework triggers __might_sleep which in turn leads to a kernel panic. Fix this by performing pm_runtime_put_autosuspend instead of doing sync. This will set the ASYNC flag and will not go for might_sleep check. Change-Id: I9cff7738def5fac94d11e7648efc3602b9fe3ea6 Signed-off-by: Udipto Goswami Signed-off-by: Rohith Kollalsi --- drivers/usb/dwc3/gadget.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index aa03c5b6da10..6452a161c89b 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -971,7 +971,7 @@ static int dwc3_gadget_ep_disable(struct usb_ep *ep) dbg_event(dep->number, "DISABLE", ret); spin_unlock_irqrestore(&dwc->lock, flags); pm_runtime_mark_last_busy(dwc->sysdev); - pm_runtime_put_sync_autosuspend(dwc->sysdev); + pm_runtime_put_autosuspend(dwc->sysdev); return ret; }