linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PM / sleep: Fix test_suspend after sleep state rework
@ 2017-02-17 13:18 Geert Uytterhoeven
  2017-02-18  1:19 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2017-02-17 13:18 UTC (permalink / raw)
  To: Rafael J. Wysocki, Pavel Machek, Len Brown
  Cc: linux-pm, linux-kernel, Geert Uytterhoeven

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>
---
 kernel/power/suspend_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/power/suspend_test.c b/kernel/power/suspend_test.c
index bdff5ed57f10a5ef..5db217051232de97 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;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-02-18  1:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-17 13:18 [PATCH] PM / sleep: Fix test_suspend after sleep state rework Geert Uytterhoeven
2017-02-18  1:19 ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).