Re: [PATCH] arm64: versal2: Initialize num_banks variable in dram_init()

Michal Simek <[email protected]>
Newsgroups org.u-boot-project.lists.u-boot
Message-ID <[email protected]>

On 8/20/26 05:34, Pranav Tilak wrote:
> 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 <[email protected]>
> ---
>   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;


Applied.
M
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.