Преглед изворни кода

MIPS: Alchemy: Fix unchecked kstrtoul return value

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 <manuel.lauss@gmail.com>
Cc: Linux-MIPS <linux-mips@linux-mips.org>
Patchwork: https://patchwork.linux-mips.org/patch/6574/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Manuel Lauss пре 11 година
родитељ
комит
d334c2b9de
2 измењених фајлова са 2 додато и 6 уклоњено
  1. 1 3
      arch/mips/alchemy/board-gpr.c
  2. 1 3
      arch/mips/alchemy/board-mtx1.c

+ 1 - 3
arch/mips/alchemy/board-gpr.c

@@ -53,10 +53,8 @@ void __init prom_init(void)
 	prom_init_cmdline();
 	prom_init_cmdline();
 
 
 	memsize_str = prom_getenv("memsize");
 	memsize_str = prom_getenv("memsize");
-	if (!memsize_str)
+	if (!memsize_str || kstrtoul(memsize_str, 0, &memsize))
 		memsize = 0x04000000;
 		memsize = 0x04000000;
-	else
-		strict_strtoul(memsize_str, 0, &memsize);
 	add_memory_region(0, memsize, BOOT_MEM_RAM);
 	add_memory_region(0, memsize, BOOT_MEM_RAM);
 }
 }
 
 

+ 1 - 3
arch/mips/alchemy/board-mtx1.c

@@ -52,10 +52,8 @@ void __init prom_init(void)
 	prom_init_cmdline();
 	prom_init_cmdline();
 
 
 	memsize_str = prom_getenv("memsize");
 	memsize_str = prom_getenv("memsize");
-	if (!memsize_str)
+	if (!memsize_str || kstrtoul(memsize_str, 0, &memsize))
 		memsize = 0x04000000;
 		memsize = 0x04000000;
-	else
-		strict_strtoul(memsize_str, 0, &memsize);
 	add_memory_region(0, memsize, BOOT_MEM_RAM);
 	add_memory_region(0, memsize, BOOT_MEM_RAM);
 }
 }