MLK-23409 net: stmmac: correctly handle mdio bus reset error path
Correctly handle mdio bus reset error path. Tested-by: Jian Li <jian.li@nxp.com> Signed-off-by: Fugang Duan <fugang.duan@nxp.com>5.4-rM2-2.2.x-imx-squashed
parent
91a988106b
commit
d1359d9382
|
@ -294,6 +294,7 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg,
|
|||
*/
|
||||
int stmmac_mdio_reset(struct mii_bus *bus)
|
||||
{
|
||||
int ret = 0;
|
||||
#if IS_ENABLED(CONFIG_STMMAC_PLATFORM)
|
||||
struct net_device *ndev = bus->priv;
|
||||
struct stmmac_priv *priv = netdev_priv(ndev);
|
||||
|
@ -307,8 +308,10 @@ int stmmac_mdio_reset(struct mii_bus *bus)
|
|||
reset_gpio = devm_gpiod_get_optional(priv->device,
|
||||
"snps,reset",
|
||||
GPIOD_OUT_LOW);
|
||||
if (IS_ERR(reset_gpio))
|
||||
return PTR_ERR(reset_gpio);
|
||||
if (IS_ERR_OR_NULL(reset_gpio)) {
|
||||
ret = PTR_ERR_OR_ZERO(reset_gpio);
|
||||
goto mdio_gpio_reset_end;
|
||||
}
|
||||
|
||||
device_property_read_u32_array(priv->device,
|
||||
"snps,reset-delays-us",
|
||||
|
@ -329,6 +332,8 @@ int stmmac_mdio_reset(struct mii_bus *bus)
|
|||
|
||||
devm_gpiod_put(priv->device, reset_gpio);
|
||||
}
|
||||
|
||||
mdio_gpio_reset_end:
|
||||
#endif
|
||||
|
||||
/* This is a workaround for problems with the STE101P PHY.
|
||||
|
@ -339,7 +344,7 @@ int stmmac_mdio_reset(struct mii_bus *bus)
|
|||
if (!priv->plat->has_gmac4)
|
||||
writel(0, priv->ioaddr + mii_address);
|
||||
#endif
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue