]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
net: fsl-mc: Incorrect variable used in error path
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Mon, 4 Aug 2025 16:56:59 +0000 (17:56 +0100)
committerPeng Fan <peng.fan@nxp.com>
Wed, 27 Aug 2025 07:42:09 +0000 (15:42 +0800)
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@linaro.org>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
drivers/net/fsl-mc/mc.c

index aad852f8151356605d5c7b6384940d8d23e2bfa0..c8ed702f50ae64876a5505730020ac5115adfd23 100644 (file)
@@ -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 */