From: Rafael J. Wysocki Date: Tue, 3 Jun 2025 16:17:58 +0000 (+0200) Subject: PM: sleep: Fix list splicing in device suspend error paths X-Git-Tag: v6.16-rc1~35^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=079e8889ad136930617278fbce44b42ef10af9e1;p=thirdparty%2Fkernel%2Flinux.git PM: sleep: Fix list splicing in device suspend error paths Commits aa7a9275ab81 ("PM: sleep: Suspend async parents after suspending children") and 443046d1ad66 ("PM: sleep: Make suspend of devices more asynchronous") added list splicing to the error paths of dpm_suspend(), dpm_suspend_late(), and dpm_noirq_suspend_devices(), but they should have used the list_splice_init() variant because the emptied list is used going forward in all of these cases. Replace list_splice() with list_splice_init() in the code in question as appropriate. Fixes: aa7a9275ab81 ("PM: sleep: Suspend async parents after suspending children") Fixes: 443046d1ad66 ("PM: sleep: Make suspend of devices more asynchronous") Link: https://gitlab.freedesktop.org/drm/amd/-/issues/4280 Reported-and-tested-by: Chris Bainbridge Signed-off-by: Rafael J. Wysocki Reviewed-by: Mario Limonciello Link: https://patch.msgid.link/4659282.LvFx2qVVIh@rjwysocki.net --- diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 19fd55b8ac77b..342681b360286 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c @@ -1451,7 +1451,7 @@ static int dpm_noirq_suspend_devices(pm_message_t state) * Move all devices to the target list to resume them * properly. */ - list_splice(&dpm_late_early_list, &dpm_noirq_list); + list_splice_init(&dpm_late_early_list, &dpm_noirq_list); break; } } @@ -1653,7 +1653,7 @@ int dpm_suspend_late(pm_message_t state) * Move all devices to the target list to resume them * properly. */ - list_splice(&dpm_suspended_list, &dpm_late_early_list); + list_splice_init(&dpm_suspended_list, &dpm_late_early_list); break; } } @@ -1946,7 +1946,7 @@ int dpm_suspend(pm_message_t state) * Move all devices to the target list to resume them * properly. */ - list_splice(&dpm_prepared_list, &dpm_suspended_list); + list_splice_init(&dpm_prepared_list, &dpm_suspended_list); break; } }