[lvc-project] [PATCH net] net: xilinx: ll_temac: handle of_address_to_resource() failure in MDIO setup

Pavel Zhigulin Pavel.Zhigulin at kaspersky.com
Fri Nov 14 18:55:18 MSK 2025


temac_mdio_setup() ignores potential errors from
of_address_to_resource() call and continues with
an uninitialized resource.

Add return value check for of_address_to_resource()
call in temac_mdio_setup().

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 8425c41d1ef7 ("net: ll_temac: Extend support to non-device-tree platforms")
Signed-off-by: Pavel Zhigulin <Pavel.Zhigulin at kaspersky.com>
---
 drivers/net/ethernet/xilinx/ll_temac_mdio.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/xilinx/ll_temac_mdio.c b/drivers/net/ethernet/xilinx/ll_temac_mdio.c
index 07a9fb49eda1..ab23dc233768 100644
--- a/drivers/net/ethernet/xilinx/ll_temac_mdio.c
+++ b/drivers/net/ethernet/xilinx/ll_temac_mdio.c
@@ -98,7 +98,9 @@ int temac_mdio_setup(struct temac_local *lp, struct platform_device *pdev)
 		return -ENOMEM;

 	if (np) {
-		of_address_to_resource(np, 0, &res);
+		rc = of_address_to_resource(np, 0, &res);
+		if (rc)
+			return rc;
 		snprintf(bus->id, MII_BUS_ID_SIZE, "%.8llx",
 			 (unsigned long long)res.start);
 	} else if (pdata) {
--
2.43.0




More information about the lvc-project mailing list