Skip to content

Commit 34284b3

Browse files
Colin Ian Kinggregkh
authored andcommitted
MIPS: generic/yamon-dt: fix uninitialized variable error
[ Upstream commit 255e51d ] In the case where fw_getenv returns an error when fetching values for ememsizea and memsize then variable phys_memsize is not assigned a variable and will be uninitialized on a zero check of phys_memsize. Fix this by initializing phys_memsize to zero. Cleans up cppcheck error: arch/mips/generic/yamon-dt.c:100:7: error: Uninitialized variable: phys_memsize [uninitvar] Fixes: f41d243 ("MIPS: generic/yamon-dt: Support > 256MB of RAM") Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent a61f90b commit 34284b3

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎arch/mips/generic/yamon-dt.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ static unsigned int __init gen_fdt_mem_array(
7575
__init int yamon_dt_append_memory(void *fdt,
7676
const struct yamon_mem_region *regions)
7777
{
78-
unsigned long phys_memsize, memsize;
78+
unsigned long phys_memsize = 0, memsize;
7979
__be32 mem_array[2 * MAX_MEM_ARRAY_ENTRIES];
8080
unsigned int mem_entries;
8181
int i, err, mem_off;

0 commit comments

Comments
 (0)