Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1583401 > unrolled thread

[PATCH] PM / sleep: Fix test_suspend after sleep state rework

Started byGeert Uytterhoeven <geert+renesas@glider.be>
First post2017-02-17 14:20 +0100
Last post2017-02-18 02:30 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] PM / sleep: Fix test_suspend after sleep state rework Geert Uytterhoeven <geert+renesas@glider.be> - 2017-02-17 14:20 +0100
    Re: [PATCH] PM / sleep: Fix test_suspend after sleep state rework "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2017-02-18 02:30 +0100

#1583401 — [PATCH] PM / sleep: Fix test_suspend after sleep state rework

FromGeert Uytterhoeven <geert+renesas@glider.be>
Date2017-02-17 14:20 +0100
Subject[PATCH] PM / sleep: Fix test_suspend after sleep state rework
Message-ID<tbQC6-4KS-11@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1583828

From"Rafael J. Wysocki" <rjw@rjwysocki.net>
Date2017-02-18 02:30 +0100
Message-ID<tc20y-3BL-7@gated-at.bofh.it>
In reply to#1583401
On Friday, February 17, 2017 02:18:44 PM Geert Uytterhoeven wrote:
> 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>

Applied.

Thanks,
Rafael

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web