Skip to content

Commit

Permalink
PM / sleep: Fix test_suspend after sleep state rework
Browse files Browse the repository at this point in the history
When passing "test_suspend=mem" to the kernel:

    PM: can't test 'mem' suspend state

and the suspend test is not run.

Commit 406e793 ("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: 406e793 (PM / sleep: System sleep state selection interface rework)
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: youling257 <youling257@gmail.com>
  • Loading branch information
geertu authored and youling257 committed Aug 10, 2017
1 parent af30524 commit cf234eb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/power/suspend_test.c
Expand Up @@ -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;
Expand Down

0 comments on commit cf234eb

Please sign in to comment.