net: stmmac: Fix error path after register_netdev move
Subsystems (4)
PATCH 1/1 net: stmmac: Fix error path after register_netdev move
Commit 5701659004d6 ("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.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +8 -1
@@ -3366,12 +3366,19 @@ int 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; +error_netdev_register: +if (priv->hw->pcs !=STMMAC_PCS_RGMII && + priv->hw->pcs !=STMMAC_PCS_TBI && + priv->hw->pcs !=STMMAC_PCS_RTBI ) +stmmac_mdio_unregister (ndev); error_mdio_register:netif_napi_del (&priv->napi); error_hw_init:
Signature · 1 line
2.9.3
A message that is not in the archive (sent off-list or not yet received): D6759987A7968C4889FDA6FA91D5CBC801CA3364@PGSMSX103.gar.corp.intel.com
Kweh, Hock Leong
Acked-byQuoted 18 lines
-----Original Message-----
From: Florian Fainelli [mailto:[email protected]]
Sent: Thursday, December 29, 2016 7:45 AM
To: [email protected]
Cc: Florian Fainelli <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Ong, Boon Leong <[email protected]>; Voon, Weifeng <[email protected]>; [email protected]; linux- [email protected]; Giuseppe Cavallaro <[email protected]>; Alexandre Torgue <[email protected]>
Subject: [PATCH net] net: stmmac: Fix error path afterregister_netdevmoveCommit
5701659004d6("net: stmmac: Fix race betweenstmmac_drv_probeandstmmac_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.
Quoted 4 lines
Fixes 5701659004d6 ("net: stmmac: Fix race between stmmac_drv_probe and
stmmac_open")Signed-off-by Florian Fainelli <[email protected]>---
Quoted 31 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +8
-2@@ -3366,12 +3366,19 @@ int 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; +error_netdev_register: +if (priv->hw->pcs !=STMMAC_PCS_RGMII && + priv->hw->pcs !=STMMAC_PCS_TBI && + priv->hw->pcs !=STMMAC_PCS_RTBI ) +stmmac_mdio_unregister (ndev); error_mdio_register:netif_napi_del (&priv->napi); error_hw_init: --2.9.3
From: Florian Fainelli <[email protected]>
Date: Wed, 28 Dec 2016 15:44:41 -0800
Quoted 7 lines
Commit
5701659004d6("net: stmmac: Fix race betweenstmmac_drv_probeandstmmac_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 5701659004d6 ("net: stmmac: Fix race between stmmac_drv_probe and stmmac_open")Signed-off-by Florian Fainelli <[email protected]>
Applied, thanks Florian.