* [PATCH] net: dsa: bcm_sf2: Unwind errors in correct order
@ 2016-07-29 19:35 Florian Fainelli
2016-07-29 19:36 ` Florian Fainelli
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Florian Fainelli @ 2016-07-29 19:35 UTC (permalink / raw)
To: netdev; +Cc: davem, andrew, vivien.didelot, Florian Fainelli
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>
---
drivers/net/dsa/bcm_sf2.c | 5 +++--
1 file 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)
"switch_0", priv);
if (ret < 0) {
pr_err("failed to request switch_0 IRQ\n");
- goto out_unmap;
+ goto out_mdio;
}
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)
out_free_irq0:
free_irq(priv->irq0, priv);
+out_mdio:
+ bcm_sf2_mdio_unregister(priv);
out_unmap:
base = &priv->core;
for (i = 0; i < BCM_SF2_REGS_NUM; i++) {
@@ -1686,7 +1688,6 @@ out_unmap:
iounmap(*base);
base++;
}
- bcm_sf2_mdio_unregister(priv);
return ret;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] net: dsa: bcm_sf2: Unwind errors in correct order
2016-07-29 19:35 [PATCH] net: dsa: bcm_sf2: Unwind errors in correct order Florian Fainelli
@ 2016-07-29 19:36 ` Florian Fainelli
2016-07-29 19:40 ` Vivien Didelot
2016-07-31 6:15 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2016-07-29 19:36 UTC (permalink / raw)
To: netdev; +Cc: davem, andrew, vivien.didelot
On 07/29/2016 12:35 PM, Florian Fainelli wrote:
> 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>
David, this is for 'net', forgot to mention it in the subject.
--
Florian
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net: dsa: bcm_sf2: Unwind errors in correct order
2016-07-29 19:35 [PATCH] net: dsa: bcm_sf2: Unwind errors in correct order Florian Fainelli
2016-07-29 19:36 ` Florian Fainelli
@ 2016-07-29 19:40 ` Vivien Didelot
2016-07-31 6:15 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Vivien Didelot @ 2016-07-29 19:40 UTC (permalink / raw)
To: Florian Fainelli, netdev; +Cc: davem, andrew, Florian Fainelli
Florian Fainelli <f.fainelli@gmail.com> writes:
> 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>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net: dsa: bcm_sf2: Unwind errors in correct order
2016-07-29 19:35 [PATCH] net: dsa: bcm_sf2: Unwind errors in correct order Florian Fainelli
2016-07-29 19:36 ` Florian Fainelli
2016-07-29 19:40 ` Vivien Didelot
@ 2016-07-31 6:15 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2016-07-31 6:15 UTC (permalink / raw)
To: f.fainelli; +Cc: netdev, andrew, vivien.didelot
From: Florian Fainelli <f.fainelli@gmail.com>
Date: Fri, 29 Jul 2016 12:35:57 -0700
> 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>
Applied, thanks Florian.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-07-31 6:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-29 19:35 [PATCH] net: dsa: bcm_sf2: Unwind errors in correct order Florian Fainelli
2016-07-29 19:36 ` Florian Fainelli
2016-07-29 19:40 ` Vivien Didelot
2016-07-31 6:15 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).