Commit 2e619a36 authored by Ray Chi's avatar Ray Chi Committed by Todd Kjos
Browse files

FROMLIST: 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.

Cc: stable@vger.kernel.org
Signed-off-by: default avatarRay Chi <raychi@google.com>

Bug: 383231852
Link: https://lore.kernel.org/linux-usb/20250106082240.3822059-1-raychi@google.com/


Change-Id: I6ae4cd685dcb0314975e0a691b6a677de73d8548
Signed-off-by: default avatarRay Chi <raychi@google.com>
parent f2550ab6
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment