usb: dwc3: re-enable runtime PM after failed resume

When dwc3_resume_common() returns an error, runtime pm is left in
suspended and disabled state in dwc3_resume(). Since the device
is suspended, its parent devices (like the power domain or glue
driver) could also be suspended and may have released resources
that dwc requires. Consequently, calling dwc3_suspend_common() in
this situation could result in attempts to access unclocked or
unpowered registers.
To prevent these problems, runtime PM should always be re-enabled,
even after failed resume attempts. This ensures that
dwc3_suspend_common() is skipped in such cases.

Fixes: 68c26fe58182 ("usb: dwc3: set pm runtime active before resume common")
Cc: stable@vger.kernel.org
Signed-off-by: Roy Luo <royluo@google.com>
Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/20240913232145.3507723-1-royluo@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by Roy Luo and committed by Greg Kroah-Hartman 897e13a8 a6555cb1

+3 -5
+3 -5
drivers/usb/dwc3/core.c
··· 2552 2552 static int dwc3_resume(struct device *dev) 2553 2553 { 2554 2554 struct dwc3 *dwc = dev_get_drvdata(dev); 2555 - int ret; 2555 + int ret = 0; 2556 2556 2557 2557 pinctrl_pm_select_default_state(dev); 2558 2558 ··· 2560 2560 pm_runtime_set_active(dev); 2561 2561 2562 2562 ret = dwc3_resume_common(dwc, PMSG_RESUME); 2563 - if (ret) { 2563 + if (ret) 2564 2564 pm_runtime_set_suspended(dev); 2565 - return ret; 2566 - } 2567 2565 2568 2566 pm_runtime_enable(dev); 2569 2567 2570 - return 0; 2568 + return ret; 2571 2569 } 2572 2570 2573 2571 static void dwc3_complete(struct device *dev)