net: dwc_eth_xgmac: Return -ENODEV when phy_connect() fails
PATCH 1/1 net: dwc_eth_xgmac: Return -ENODEV when phy_connect() fails
When multiple Ethernet controllers are enabled in the device tree, but only one controller is actually present in hardware, the non-existent controller still attempts to connect to a PHY.
In this case, phy_connect() may return NULL without setting an error code. The current driver only logs the failure but does not propagate an error, causing the initialization flow to continue with an invalid PHY handle.
This leads to failures later in the initialization sequence.
Fix this by explicitly setting ret = -ENODEV when phy_connect() returns NULL, ensuring the driver exits cleanly on failure.
--- drivers/net/dwc_eth_xgmac.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/dwc_eth_xgmac.c +1 -0
@@ -507,6 +507,7 @@ static int xgmac_start(struct udevice *dev) xgmac->config->interface(dev));if (!xgmac->phy) {pr_err ("%s phy_connect() failed\n" , dev->name); + ret = -ENODEV ; goto err_stop_resets; }
Signature · 1 line
2.43.7
Quoted 10 lines · Boon Khai Ng
When multiple Ethernet controllers are enabled in the device tree, but only one controller is actually present in hardware, the non-existent controller still attempts to connect to a PHY.
In this case,
phy_connect()may return NULL without setting an error code. The current driver only logs the failure but does not propagate an error, causing the initialization flow to continue with an invalid PHY handle.[...]
Applied to u-boot-net/for-master, thanks!
[1/1] net: dwc_eth_xgmac: Return -ENODEV when phy_connect() fails
commit: 41913031b3411d523302fdc9acd4dc3dd4f02677
Best regards,
Signature · 1 line
Jerome Forissier <[email protected]>