Skip to content

Commit 544e737

Browse files
committed
PM: sleep: Fix error handling in dpm_prepare()
Commit 2aa3660 ("PM: sleep: Avoid calling put_device() under dpm_list_mtx") forgot to update the while () loop termination condition to also break the loop if error is nonzero, which causes the loop to become infinite if device_prepare() returns an error for one device. Add the missing !error check. Fixes: 2aa3660 ("PM: sleep: Avoid calling put_device() under dpm_list_mtx") Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reported-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org> Cc: All applicable <stable@vger.kernel.org>
1 parent 2585cf9 commit 544e737

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/base/power/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1902,7 +1902,7 @@ int dpm_prepare(pm_message_t state)
19021902
device_block_probing();
19031903

19041904
mutex_lock(&dpm_list_mtx);
1905-
while (!list_empty(&dpm_list)) {
1905+
while (!list_empty(&dpm_list) && !error) {
19061906
struct device *dev = to_device(dpm_list.next);
19071907

19081908
get_device(dev);

0 commit comments

Comments
 (0)