aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/dsa
diff options
context:
space:
mode:
authorFlorian Fainelli <f.fainelli@gmail.com>2016-07-29 15:35:57 -0400
committerDavid S. Miller <davem@davemloft.net>2016-07-31 02:14:52 -0400
commitbb9c0fa3aa2932eb3825557e452cac248e709bef (patch)
tree7c3f187452ad65bd4244b56dcc3755e27cf72233 /drivers/net/dsa
parent33c77efbbef92cffd0d1f351fad816eeefbbdeb9 (diff)
net: dsa: bcm_sf2: Unwind errors in correct order
In case we cannot complete bcm_sf2_sw_setup() for any reason, and we go to the out_unmap label, but the MDIO bus has not been registered yet, we will hit the BUG condition in drivers/net/phy/mdio_bus.c about the bus not being registered. Fix this by dedicating a specific lable for when we fail after the MDIO bus has been successfully registered. Fixes: 461cd1b03e32 ("net: dsa: bcm_sf2: Register our slave MDIO bus") Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/dsa')
-rw-r--r--drivers/net/dsa/bcm_sf2.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
index cd1d630ae3a9..b2b838724a9b 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -1622,7 +1622,7 @@ static int bcm_sf2_sw_setup(struct dsa_switch *ds)
1622 "switch_0", priv); 1622 "switch_0", priv);
1623 if (ret < 0) { 1623 if (ret < 0) {
1624 pr_err("failed to request switch_0 IRQ\n"); 1624 pr_err("failed to request switch_0 IRQ\n");
1625 goto out_unmap; 1625 goto out_mdio;
1626 } 1626 }
1627 1627
1628 ret = request_irq(priv->irq1, bcm_sf2_switch_1_isr, 0, 1628 ret = request_irq(priv->irq1, bcm_sf2_switch_1_isr, 0,
@@ -1679,6 +1679,8 @@ static int bcm_sf2_sw_setup(struct dsa_switch *ds)
1679 1679
1680out_free_irq0: 1680out_free_irq0:
1681 free_irq(priv->irq0, priv); 1681 free_irq(priv->irq0, priv);
1682out_mdio:
1683 bcm_sf2_mdio_unregister(priv);
1682out_unmap: 1684out_unmap:
1683 base = &priv->core; 1685 base = &priv->core;
1684 for (i = 0; i < BCM_SF2_REGS_NUM; i++) { 1686 for (i = 0; i < BCM_SF2_REGS_NUM; i++) {
@@ -1686,7 +1688,6 @@ out_unmap:
1686 iounmap(*base); 1688 iounmap(*base);
1687 base++; 1689 base++;
1688 } 1690 }
1689 bcm_sf2_mdio_unregister(priv);
1690 return ret; 1691 return ret;
1691} 1692}
1692 1693