Skip to content

Commit

Permalink
MIPS: Alchemy: Fix unchecked kstrtoul return value
Browse files Browse the repository at this point in the history
enabled __must_check logic triggers a build error for mtx1 and gpr
in the prom init code.  Fix by checking the kstrtoul() return value.

Signed-off-by: Manuel Lauss <[email protected]>
Cc: Linux-MIPS <[email protected]>
Patchwork: https://patchwork.linux-mips.org/patch/6574/
Signed-off-by: Ralf Baechle <[email protected]>
  • Loading branch information
mlauss2 authored and ralfbaechle committed Mar 6, 2014
1 parent f517928 commit d334c2b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 1 addition & 3 deletions arch/mips/alchemy/board-gpr.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,8 @@ void __init prom_init(void)
prom_init_cmdline();

memsize_str = prom_getenv("memsize");
if (!memsize_str)
if (!memsize_str || kstrtoul(memsize_str, 0, &memsize))
memsize = 0x04000000;
else
strict_strtoul(memsize_str, 0, &memsize);
add_memory_region(0, memsize, BOOT_MEM_RAM);
}

Expand Down
4 changes: 1 addition & 3 deletions arch/mips/alchemy/board-mtx1.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,8 @@ void __init prom_init(void)
prom_init_cmdline();

memsize_str = prom_getenv("memsize");
if (!memsize_str)
if (!memsize_str || kstrtoul(memsize_str, 0, &memsize))
memsize = 0x04000000;
else
strict_strtoul(memsize_str, 0, &memsize);
add_memory_region(0, memsize, BOOT_MEM_RAM);
}

Expand Down

0 comments on commit d334c2b

Please sign in to comment.