U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64: versal2: Initialize num_banks variable in dram_init()
@ 2026-08-20  3:34 Pranav Tilak
  2026-08-24 14:59 ` Michal Simek
  0 siblings, 1 reply; 2+ messages in thread
From: Pranav Tilak @ 2026-08-20  3:34 UTC (permalink / raw)
  To: u-boot, michal.simek
  Cc: git, padmarao.begari, Pranav Tilak, Tom Rini, Suraj Kakade,
	Pranav Sanwal

In dram_init() num_banks is incremented for every detected DRAM bank
and passed to mem_map_fill() without being initialized, which can add
invalid entries to versal2_mem_map[], so initialize it to zero.

Fixes: 3aebac5a759b ("arm64: versal2: Populate DRAM banks before page table size calculation")
Signed-off-by: Pranav Tilak <pranav.vinaytilak@amd.com>
---
 board/amd/versal2/board.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/board/amd/versal2/board.c b/board/amd/versal2/board.c
index 15b79bbea69..ef6eb1af482 100644
--- a/board/amd/versal2/board.c
+++ b/board/amd/versal2/board.c
@@ -262,7 +262,8 @@ int dram_init(void)
 	ofnode mem = ofnode_null();
 	struct resource res;
 	int ret, i, reg = 0;
-	u32 num_banks, reloc_use = 0;
+	u32 num_banks = 0;
+	u32 reloc_use = 0;
 	u64 text = (u64)_start;
 
 	gd->ram_base = (unsigned long)~0;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-24 14:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-20  3:34 [PATCH] arm64: versal2: Initialize num_banks variable in dram_init() Pranav Tilak
2026-08-24 14:59 ` Michal Simek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox