From: Geert Uytterhoeven Date: Fri, 17 Feb 2017 13:18:44 +0000 (+0100) Subject: PM / sleep: Fix test_suspend after sleep state rework X-Git-Tag: v4.14-rc1~1361^2^4~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8cff66791a6bfc8fb98f93e4e7c13fd06afecf7a;p=platform%2Fkernel%2Flinux-rpi3.git PM / sleep: Fix test_suspend after sleep state rework When passing "test_suspend=mem" to the kernel: PM: can't test 'mem' suspend state and the suspend test is not run. Commit 406e79385f3223d8 ("PM / sleep: System sleep state selection interface rework") changed pm_labels[] from a contiguous NULL-terminated array to a sparse array (with the first element unpopulated), breaking the assumptions of the iterator in setup_test_suspend(). Iterate from PM_SUSPEND_MIN to PM_SUSPEND_MAX - 1 to fix this. Fixes: 406e79385f3223d8 (PM / sleep: System sleep state selection interface rework) Signed-off-by: Geert Uytterhoeven Signed-off-by: Rafael J. Wysocki --- diff --git a/kernel/power/suspend_test.c b/kernel/power/suspend_test.c index bdff5ed..5db2170 100644 --- a/kernel/power/suspend_test.c +++ b/kernel/power/suspend_test.c @@ -166,7 +166,7 @@ static int __init setup_test_suspend(char *value) return 0; } - for (i = 0; pm_labels[i]; i++) + for (i = PM_SUSPEND_MIN; i < PM_SUSPEND_MAX; i++) if (!strcmp(pm_labels[i], suspend_type)) { test_state_label = pm_labels[i]; return 0;