summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2024-02-19 14:30:59 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2024-02-20 08:16:51 +0100
commit1d8515a0d3f78eae1891bf7ff3b662cb722d45a1 (patch)
tree5d292eb139069a5ab152023d9f0672c7cca5f68c
parent70b782b6b222993b5ec63f6bcb53dcf5f721f42d (diff)
downloadbarebox-1d8515a0d3f7.tar.gz
barebox-1d8515a0d3f7.tar.xz
ddr: fsl: fix possible use of uninitalized variable
step_assign_addresses_interleaved() contains a loop that either sets total_mem to a fixed value or keeps incrementing it. If we exclusively run into the "keep incrementing it"-case, we would start with an uninitialized total_mem. Fix this by initializing it to 0. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240219133059.3771473-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--drivers/ddr/fsl/main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/ddr/fsl/main.c b/drivers/ddr/fsl/main.c
index 27303fec7e..c8217a86dd 100644
--- a/drivers/ddr/fsl/main.c
+++ b/drivers/ddr/fsl/main.c
@@ -97,7 +97,7 @@ static unsigned long long step_assign_addresses_linear(struct fsl_ddr_info *pinf
static unsigned long long step_assign_addresses_interleaved(struct fsl_ddr_info *pinfo,
unsigned long long current_mem_base)
{
- unsigned long long total_mem, total_ctlr_mem;
+ unsigned long long total_mem = 0, total_ctlr_mem;
unsigned long long rank_density, ctlr_density = 0;
int i;