Skip to content

Commit 616feab

Browse files
Fabian Fredericktorvalds
authored andcommitted
kernel/reboot.c: convert simple_strtoul to kstrtoint
Replace obsolete function. kstrtoint is used as reboot_cpu is an integer. Signed-off-by: Fabian Frederick <fabf@skynet.be> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 6c5a53c commit 616feab

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

kernel/reboot.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -388,15 +388,22 @@ static int __init reboot_setup(char *str)
388388
break;
389389

390390
case 's':
391-
if (isdigit(*(str+1)))
392-
reboot_cpu = simple_strtoul(str+1, NULL, 0);
393-
else if (str[1] == 'm' && str[2] == 'p' &&
394-
isdigit(*(str+3)))
395-
reboot_cpu = simple_strtoul(str+3, NULL, 0);
396-
else
391+
{
392+
int rc;
393+
394+
if (isdigit(*(str+1))) {
395+
rc = kstrtoint(str+1, 0, &reboot_cpu);
396+
if (rc)
397+
return rc;
398+
} else if (str[1] == 'm' && str[2] == 'p' &&
399+
isdigit(*(str+3))) {
400+
rc = kstrtoint(str+3, 0, &reboot_cpu);
401+
if (rc)
402+
return rc;
403+
} else
397404
reboot_mode = REBOOT_SOFT;
398405
break;
399-
406+
}
400407
case 'g':
401408
reboot_mode = REBOOT_GPIO;
402409
break;

0 commit comments

Comments
 (0)