[PATCH] net: mediatek: Use correct variable for return

Andrew Goodbody andrew.goodbody at linaro.org
Tue Aug 5 13:04:00 CEST 2025


In mtk_eth_of_to_plat, the last error check has the value in
'priv->phy_addr' but returns ret. Correct to return 'priv->phy_addr'
instead.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody at linaro.org>
---
 drivers/net/mtk_eth/mtk_eth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/mtk_eth/mtk_eth.c b/drivers/net/mtk_eth/mtk_eth.c
index 5d6a42bceb4..b172838ba3a 100644
--- a/drivers/net/mtk_eth/mtk_eth.c
+++ b/drivers/net/mtk_eth/mtk_eth.c
@@ -1461,7 +1461,7 @@ static int mtk_eth_of_to_plat(struct udevice *dev)
 		priv->phy_addr = ofnode_read_s32_default(args.node, "reg", -1);
 		if (priv->phy_addr < 0) {
 			printf("error: phy address is not specified\n");
-			return ret;
+			return priv->phy_addr;
 		}
 	}
 

---
base-commit: 007610da2cca405ea7739fc120d90085be4b6ac2
change-id: 20250805-mtk_eth-e318323a0dc1

Best regards,
-- 
Andrew Goodbody <andrew.goodbody at linaro.org>



More information about the U-Boot mailing list