summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoon Khai Ng <[email protected]>2026-07-14 15:19:27 +0800
committerJerome Forissier <[email protected]>2026-07-23 17:05:21 +0200
commitf517fdbc0ddcb9bdcb773640f164ddcb924d877c (patch)
tree22b469d8a48480832c734b0913cc0bf35a4df455
parent495368c5538303c3026eb32afd6f7027fbc88a0e (diff)
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. Signed-off-by: Boon Khai Ng <[email protected]>
-rw-r--r--drivers/net/dwc_eth_xgmac.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/net/dwc_eth_xgmac.c b/drivers/net/dwc_eth_xgmac.c
index 311b57011c3..4e664a88f68 100644
--- a/drivers/net/dwc_eth_xgmac.c
+++ b/drivers/net/dwc_eth_xgmac.c
@@ -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;
}