[PATCH 1/5] PM: runtime: Cancel pending only during non-transient suspend failure
From: Brian Norris
Date: Tue Sep 29 2026 - 14:48:37 EST
If runtime_suspend() fails for transient reasons (EBUSY, EAGAIN), we
intend to allow retrying suspend in many cases. However, on the failure
path we unconditionally cancel any pending timers, which means a suspend
timer scheduled while the callback was running (e.g., via
pm_schedule_suspend()) may be prematurely aborted.
This seems to have inadvertently changed with commit 72263869656d ("PM:
runtime: Unify error handling during suspend and resume"), where the
error-handling logic in rpm_suspend() was subtly changed.
Fixes: 72263869656d ("PM: runtime: Unify error handling during suspend and resume")
Signed-off-by: Brian Norris <briannorris@xxxxxxxxxxxx>
---
drivers/base/power/runtime.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
index bb008dfe85a1..bc5905ffc45f 100644
--- a/drivers/base/power/runtime.c
+++ b/drivers/base/power/runtime.c
@@ -749,8 +749,10 @@ static int rpm_suspend(struct device *dev, int rpmflags)
dev->power.deferred_resume = false;
wake_up_all(&dev->power.wait_queue);
- if (retval != -EAGAIN && retval != -EBUSY)
+ if (retval != -EAGAIN && retval != -EBUSY) {
dev->power.runtime_error = retval;
+ pm_runtime_cancel_pending(dev);
+ }
/*
* On transient errors, if the callback routine failed an autosuspend,
@@ -762,8 +764,6 @@ static int rpm_suspend(struct device *dev, int rpmflags)
pm_runtime_autosuspend_expiration(dev) != 0)
goto repeat;
- pm_runtime_cancel_pending(dev);
-
goto out;
}
--
2.56.0.rc1.315.gc6ed9934b7-goog