Commit ca92b798 authored by Florian Fainelli's avatar Florian Fainelli Committed by Ben Hutchings

net: stmmac: Fix error path after register_netdev move

commit b2eb09af upstream.

Commit 57016590 ("net: stmmac: Fix race between stmmac_drv_probe and
stmmac_open") re-ordered how the MDIO bus registration and the network
device are registered, but missed to unwind the MDIO bus registration in
case we fail to register the network device.

Fixes: 57016590 ("net: stmmac: Fix race between stmmac_drv_probe and stmmac_open")
Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Acked-by: default avatarKweh, Hock Leong <hock.leong.kweh@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
[bwh: Backported to 3.16:
 - stmmac_dvr_probe() returns a pointer
 - 'pcs' is a member of struct stmmac_priv, not struct mac_device_info]
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent ea6835ec
......@@ -2794,12 +2794,19 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device,
}
ret = register_netdev(ndev);
if (ret)
if (ret) {
netdev_err(priv->dev, "%s: ERROR %i registering the device\n",
__func__, ret);
goto error_netdev_register;
}
return ret ? ERR_PTR(ret) : priv;
return priv;
error_netdev_register:
if (priv->pcs != STMMAC_PCS_RGMII &&
priv->pcs != STMMAC_PCS_TBI &&
priv->pcs != STMMAC_PCS_RTBI)
stmmac_mdio_unregister(ndev);
error_mdio_register:
netif_napi_del(&priv->napi);
error_hw_init:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment