aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert+renesas@glider.be>2017-02-17 08:18:44 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-02-17 20:16:27 -0500
commit8cff66791a6bfc8fb98f93e4e7c13fd06afecf7a (patch)
treeea6f6398c46c1e2b106feaa858fdff94af8eb6db
parent858a0d7eb5300b5f620d98ab3c4b96c9d5f19131 (diff)
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 <geert+renesas@glider.be> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--kernel/power/suspend_test.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/power/suspend_test.c b/kernel/power/suspend_test.c
index bdff5ed57f10..5db217051232 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)
166 return 0; 166 return 0;
167 } 167 }
168 168
169 for (i = 0; pm_labels[i]; i++) 169 for (i = PM_SUSPEND_MIN; i < PM_SUSPEND_MAX; i++)
170 if (!strcmp(pm_labels[i], suspend_type)) { 170 if (!strcmp(pm_labels[i], suspend_type)) {
171 test_state_label = pm_labels[i]; 171 test_state_label = pm_labels[i];
172 return 0; 172 return 0;