diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2020-04-29 18:09:32 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-04-30 21:00:17 -0700 |
commit | ab1c637cc6d80c0ee1d5d15f7ec8977f49feee75 (patch) | |
tree | fe5c2c4eecc3874e50090d91cef04d81e33681fd /drivers/net/ethernet/stmicro | |
parent | 6ef4889fc0b3aa6ab928e7565935ac6f762cee6e (diff) | |
download | linux-ab1c637cc6d80c0ee1d5d15f7ec8977f49feee75.tar.gz linux-ab1c637cc6d80c0ee1d5d15f7ec8977f49feee75.tar.bz2 linux-ab1c637cc6d80c0ee1d5d15f7ec8977f49feee75.zip |
stmmac: intel: Fix kernel crash due to wrong error path
Unfortunately sometimes ->probe() may fail. The commit b9663b7ca6ff
("net: stmmac: Enable SERDES power up/down sequence")
messed up with error handling and thus:
[ 12.811311] ------------[ cut here ]------------
[ 12.811993] kernel BUG at net/core/dev.c:9937!
Fix this by properly crafted error path.
Fixes: b9663b7ca6ff ("net: stmmac: Enable SERDES power up/down sequence")
Cc: Voon Weifeng <weifeng.voon@intel.com>
Cc: Ong Boon Leong <boon.leong.ong@intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/stmicro')
-rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 565da6498c84..ff22f274aa43 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -4991,7 +4991,7 @@ int stmmac_dvr_probe(struct device *device, priv->plat->bsp_priv); if (ret < 0) - return ret; + goto error_serdes_powerup; } #ifdef CONFIG_DEBUG_FS @@ -5000,6 +5000,8 @@ int stmmac_dvr_probe(struct device *device, return ret; +error_serdes_powerup: + unregister_netdev(ndev); error_netdev_register: phylink_destroy(priv->phylink); error_phy_setup: |