Skip to content

Commit 7a64ca1

Browse files
rddunlaprafaeljw
authored andcommitted
PM: suspend: fix return value of __setup handler
If an invalid option is given for "test_suspend=<option>", the entire string is added to init's environment, so return 1 instead of 0 from the __setup handler. Unknown kernel command line parameters "BOOT_IMAGE=/boot/bzImage-517rc5 test_suspend=invalid" and Run /sbin/init as init process with arguments: /sbin/init with environment: HOME=/ TERM=linux BOOT_IMAGE=/boot/bzImage-517rc5 test_suspend=invalid Fixes: 2ce9868 ("PM / sleep: Enhance test_suspend option with repeat capability") Fixes: 27ddcc6 ("PM / sleep: Add state field to pm_states[] entries") Fixes: a9d7052 ("PM: Separate suspend to RAM functionality from core") Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Reported-by: Igor Zhbanov <i.zhbanov@omprussia.ru> Link: lore.kernel.org/r/64644a2f-4a20-bab3-1e15-3b2cdd0defe3@omprussia.ru Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent ba7ffcd commit 7a64ca1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

kernel/power/suspend_test.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,22 +157,22 @@ static int __init setup_test_suspend(char *value)
157157
value++;
158158
suspend_type = strsep(&value, ",");
159159
if (!suspend_type)
160-
return 0;
160+
return 1;
161161

162162
repeat = strsep(&value, ",");
163163
if (repeat) {
164164
if (kstrtou32(repeat, 0, &test_repeat_count_max))
165-
return 0;
165+
return 1;
166166
}
167167

168168
for (i = PM_SUSPEND_MIN; i < PM_SUSPEND_MAX; i++)
169169
if (!strcmp(pm_labels[i], suspend_type)) {
170170
test_state_label = pm_labels[i];
171-
return 0;
171+
return 1;
172172
}
173173

174174
printk(warn_bad_state, suspend_type);
175-
return 0;
175+
return 1;
176176
}
177177
__setup("test_suspend", setup_test_suspend);
178178

0 commit comments

Comments
 (0)