diff options
author | Andre Przywara <andre.przywara@arm.com> | 2020-07-06 01:40:32 +0100 |
---|---|---|
committer | Jagan Teki <jagan@amarulasolutions.com> | 2020-10-21 23:42:11 +0530 |
commit | 2808cf6c60b5484296651e23066c4b36594f0240 (patch) | |
tree | d4d561ed2f212c52c5d48a7963716766ea5f3775 /drivers/net/sun8i_emac.c | |
parent | 7ec87e4192215815b658c3f8b34e4be010103149 (diff) | |
download | u-boot-2808cf6c60b5484296651e23066c4b36594f0240.tar.gz |
net: sun8i-emac: Bail out on PHY error
When phy_startup() returns with an error, because there is no link or
the user interrupted the process, we shall stop the _start() routine
and return with an error, instead of proceeding anyway.
This fixes pointless operations when there is no Ethernet cable
connected, for instance.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <mripard@kernel.org>
Tested-by: Amit Singh Tomar <amittomer25@gmail.com> # Pine64+
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Diffstat (limited to 'drivers/net/sun8i_emac.c')
-rw-r--r-- | drivers/net/sun8i_emac.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/net/sun8i_emac.c b/drivers/net/sun8i_emac.c index 1dae81c7bf..ddbcf26347 100644 --- a/drivers/net/sun8i_emac.c +++ b/drivers/net/sun8i_emac.c @@ -435,6 +435,7 @@ static int _sun8i_emac_eth_init(struct emac_eth_dev *priv, u8 *enetaddr) { u32 reg, v; int timeout = 100; + int ret; reg = readl((priv->mac_reg + EMAC_CTL1)); @@ -473,7 +474,9 @@ static int _sun8i_emac_eth_init(struct emac_eth_dev *priv, u8 *enetaddr) tx_descs_init(priv); /* PHY Start Up */ - phy_startup(priv->phydev); + ret = phy_startup(priv->phydev); + if (ret) + return ret; sun8i_adjust_link(priv, priv->phydev); |