From: Conor Dooley <conor.dooley@microchip.com>
Date: Wed, 15 May 2024 15:04:30 +0000 (+0100)
Subject: board: microchip: icicle: correct type for node offset
X-Git-Tag: v2025.01-rc5-pxa1908~465^2~6
X-Git-Url: http://git.dujemihanovic.xyz/img/static//%22brlog.php?a=commitdiff_plain;h=d4573c05cbea34f8d7c3c2d5e49b7b057b895882;p=u-boot.git

board: microchip: icicle: correct type for node offset

Node offsets returned by libfdt can contain negative error numbers, so
the variable type should be "int". As things stand, if the ethernet
nodes are not found in the early init callback, the if (node < 0) tests
pass and the code errors out while trying to set the local-mac-address
for a non-existent node.

Fixes: 64413e1b7c ("riscv: Add Microchip MPFS Icicle Kit support")
Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
---

diff --git a/board/microchip/mpfs_icicle/mpfs_icicle.c b/board/microchip/mpfs_icicle/mpfs_icicle.c
index 0f5f82924e..844937951c 100644
--- a/board/microchip/mpfs_icicle/mpfs_icicle.c
+++ b/board/microchip/mpfs_icicle/mpfs_icicle.c
@@ -73,7 +73,7 @@ int board_early_init_f(void)
 int board_late_init(void)
 {
 	u32 ret;
-	u32 node;
+	int node;
 	u8 idx;
 	u8 device_serial_number[16] = { 0 };
 	unsigned char mac_addr[6];