[PATCH 5/5] net: fsl-mc: Incorrect variable used in error path

Andrew Goodbody andrew.goodbody at linaro.org
Mon Aug 4 18:56:59 CEST 2025


In mc_fixup_dpc_mac_addr noff is assigned the return value from
fdt_add_subnode so that is the variable that should be passed to
fdt_strerror and returned when negative.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody at linaro.org>
---
 drivers/net/fsl-mc/mc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/fsl-mc/mc.c b/drivers/net/fsl-mc/mc.c
index aad852f8151..c8ed702f50a 100644
--- a/drivers/net/fsl-mc/mc.c
+++ b/drivers/net/fsl-mc/mc.c
@@ -366,8 +366,8 @@ static int mc_fixup_dpc_mac_addr(void *blob, int dpmac_id,
 		noff = fdt_add_subnode(blob, nodeoffset, mac_name);
 		if (noff < 0) {
 			printf("fdt_add_subnode: err=%s\n",
-			       fdt_strerror(err));
-			return err;
+			       fdt_strerror(noff));
+			return noff;
 		}
 
 		/* add default property of fixed link */

-- 
2.39.5



More information about the U-Boot mailing list