Skip to content

Commit

Permalink
stmmac: intel: Fix kernel crash due to wrong error path
Browse files Browse the repository at this point in the history
Unfortunately sometimes ->probe() may fail. The commit b9663b7
("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: b9663b7 ("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>
  • Loading branch information
Andy Shevchenko authored and David S. Miller committed Apr 30, 2020
1 parent fe4f961 commit 801eb05
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit 801eb05

Please sign in to comment.