1
0
Fork 0

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
Fugang Duan 2020-02-29 16:30:48 +08:00
parent 91a988106b
commit d1359d9382
1 changed files with 8 additions and 3 deletions

View File

@ -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;
}
/**