On 10/27/26 08:43, Hung-Chun Tseng wrote:
> read_ddr_info() passes i to read_tlvinfo_tlv_eeprom() as the EEPROM
> device index before giving it a value, so which device is read depends
> on whatever is on the stack. read_product_name() does the same call
> with i set to 0.
>
> Initialise i to 0 in read_ddr_info() as well.
>
> Fixes: 83026cf8f90b ("spacemit: k1: Add DDR firmware support to SPL")
> Signed-off-by: Hung-Chun Tseng <[email protected]>
> ---
> board/spacemit/k1/spl.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/board/spacemit/k1/spl.c b/board/spacemit/k1/spl.c
> index cc0e26bb0..60f5d8c56 100644
> --- a/board/spacemit/k1/spl.c
> +++ b/board/spacemit/k1/spl.c
> @@ -332,7 +332,7 @@ int read_ddr_info(struct ddr_cfg *cfg)
> struct tlvinfo_header *tlv_hdr;
> struct tlvinfo_tlv *tlv_entry;
> u32 size, entry_size;
> - int ret, i;
> + int ret, i = 0;
> bool found = false;
>
> if (!cfg)
LGTM
Reviewed-by: E Shattow <[email protected]>