When rproc_crash_handler_work() finds the remoteproc is already in
RPROC_CRASHED state, it exits via a bare return, bypassing the out:
label and its pm_relax() call.  Since rproc_report_crash() always
calls pm_stay_awake() before queuing the work, every crash reported
after the first leaves the wakeup source permanently active, preventing
system suspend until the device is removed.

Change the bare return to goto out so pm_relax() is reached on all
exit paths.

Fixes: a781e5aa5911 ("remoteproc: core: Prevent system suspend during 
remoteproc recovery")
Cc: [email protected]
Signed-off-by: Mukesh Ojha <[email protected]>
---
 drivers/remoteproc/remoteproc_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/remoteproc/remoteproc_core.c 
b/drivers/remoteproc/remoteproc_core.c
index 1ed406714849..ee9354ff69f0 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -1896,7 +1896,7 @@ static void rproc_crash_handler_work(struct work_struct 
*work)
        if (rproc->state == RPROC_CRASHED) {
                /* handle only the first crash detected */
                mutex_unlock(&rproc->lock);
-               return;
+               goto out;
        }
 
        if (rproc->state == RPROC_OFFLINE) {
-- 
2.53.0


Reply via email to