Skip to content

Commit e3a9bd2

Browse files
Ray Chigregkh
authored andcommitted
usb: dwc3: Skip resume if pm_runtime_set_active() fails
When the system begins to enter suspend mode, dwc3_suspend() is called by PM suspend. There is a problem that if someone interrupt the system suspend process between dwc3_suspend() and pm_suspend() of its parent device, PM suspend will be canceled and attempt to resume suspended devices so that dwc3_resume() will be called. However, dwc3 and its parent device (like the power domain or glue driver) may already be suspended by runtime PM in fact. If this sutiation happened, the pm_runtime_set_active() in dwc3_resume() will return an error since parent device was suspended. This can lead to unexpected behavior if DWC3 proceeds to execute dwc3_resume_common(). EX. RPM suspend: ... -> dwc3_runtime_suspend() -> rpm_suspend() of parent device ... PM suspend: ... -> dwc3_suspend() -> pm_suspend of parent device ^ interrupt, so resume suspended device ... <- dwc3_resume() <-/ ^ pm_runtime_set_active() returns error To prevent the problem, this commit will skip dwc3_resume_common() and return the error if pm_runtime_set_active() fails. Fixes: 68c26fe ("usb: dwc3: set pm runtime active before resume common") Cc: stable <[email protected]> Signed-off-by: Ray Chi <[email protected]> Acked-by: Thinh Nguyen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent a181c8e commit e3a9bd2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/usb/dwc3/core.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2609,12 +2609,15 @@ static int dwc3_resume(struct device *dev)
26092609
pinctrl_pm_select_default_state(dev);
26102610

26112611
pm_runtime_disable(dev);
2612-
pm_runtime_set_active(dev);
2612+
ret = pm_runtime_set_active(dev);
2613+
if (ret)
2614+
goto out;
26132615

26142616
ret = dwc3_resume_common(dwc, PMSG_RESUME);
26152617
if (ret)
26162618
pm_runtime_set_suspended(dev);
26172619

2620+
out:
26182621
pm_runtime_enable(dev);
26192622

26202623
return ret;

0 commit comments

Comments
 (0)