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.goodb...@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

Reply via email to