Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1637747 > unrolled thread
| Started by | Jon Mason <jon.mason@broadcom.com> |
|---|---|
| First post | 2017-05-08 23:50 +0200 |
| Last post | 2017-05-09 00:10 +0200 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH] net: mdio-mux: bcm-iproc: call mdiobus_free() in error path Jon Mason <jon.mason@broadcom.com> - 2017-05-08 23:50 +0200
Re: [PATCH] net: mdio-mux: bcm-iproc: call mdiobus_free() in error path Florian Fainelli <f.fainelli@gmail.com> - 2017-05-09 00:00 +0200
Re: [PATCH] net: mdio-mux: bcm-iproc: call mdiobus_free() in error path David Miller <davem@davemloft.net> - 2017-05-09 00:10 +0200
| From | Jon Mason <jon.mason@broadcom.com> |
|---|---|
| Date | 2017-05-08 23:50 +0200 |
| Subject | [PATCH] net: mdio-mux: bcm-iproc: call mdiobus_free() in error path |
| Message-ID | <tEYHv-Wn-3@gated-at.bofh.it> |
If an error is encountered in mdio_mux_init(), the error path will call
mdiobus_free(). Since mdiobus_register() has been called prior to
mdio_mux_init(), the bus->state will not be MDIOBUS_UNREGISTERED. This
causes a BUG_ON() in mdiobus_free(). To correct this issue, add an
error path for mdio_mux_init() which calls mdiobus_unregister() prior to
mdiobus_free().
Signed-off-by: Jon Mason <jon.mason@broadcom.com>
Fixes: 98bc865a1ec8 ("net: mdio-mux: Add MDIO mux driver for iProc SoCs")
---
drivers/net/phy/mdio-mux-bcm-iproc.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/phy/mdio-mux-bcm-iproc.c b/drivers/net/phy/mdio-mux-bcm-iproc.c
index 0a0412524cec..0a5f62e0efcc 100644
--- a/drivers/net/phy/mdio-mux-bcm-iproc.c
+++ b/drivers/net/phy/mdio-mux-bcm-iproc.c
@@ -203,11 +203,14 @@ static int mdio_mux_iproc_probe(struct platform_device *pdev)
&md->mux_handle, md, md->mii_bus);
if (rc) {
dev_info(md->dev, "mdiomux initialization failed\n");
- goto out;
+ goto out_register;
}
dev_info(md->dev, "iProc mdiomux registered\n");
return 0;
+
+out_register:
+ mdiobus_unregister(bus);
out:
mdiobus_free(bus);
return rc;
--
2.7.4
[toc] | [next] | [standalone]
| From | Florian Fainelli <f.fainelli@gmail.com> |
|---|---|
| Date | 2017-05-09 00:00 +0200 |
| Subject | Re: [PATCH] net: mdio-mux: bcm-iproc: call mdiobus_free() in error path |
| Message-ID | <tEYRc-ZP-9@gated-at.bofh.it> |
| In reply to | #1637747 |
On 05/08/2017 02:48 PM, Jon Mason wrote:
> If an error is encountered in mdio_mux_init(), the error path will call
> mdiobus_free(). Since mdiobus_register() has been called prior to
> mdio_mux_init(), the bus->state will not be MDIOBUS_UNREGISTERED. This
> causes a BUG_ON() in mdiobus_free(). To correct this issue, add an
> error path for mdio_mux_init() which calls mdiobus_unregister() prior to
> mdiobus_free().
>
> Signed-off-by: Jon Mason <jon.mason@broadcom.com>
> Fixes: 98bc865a1ec8 ("net: mdio-mux: Add MDIO mux driver for iProc SoCs")
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian
[toc] | [prev] | [next] | [standalone]
| From | David Miller <davem@davemloft.net> |
|---|---|
| Date | 2017-05-09 00:10 +0200 |
| Subject | Re: [PATCH] net: mdio-mux: bcm-iproc: call mdiobus_free() in error path |
| Message-ID | <tEZ0S-1js-5@gated-at.bofh.it> |
| In reply to | #1637747 |
From: Jon Mason <jon.mason@broadcom.com>
Date: Mon, 8 May 2017 17:48:35 -0400
> If an error is encountered in mdio_mux_init(), the error path will call
> mdiobus_free(). Since mdiobus_register() has been called prior to
> mdio_mux_init(), the bus->state will not be MDIOBUS_UNREGISTERED. This
> causes a BUG_ON() in mdiobus_free(). To correct this issue, add an
> error path for mdio_mux_init() which calls mdiobus_unregister() prior to
> mdiobus_free().
>
> Signed-off-by: Jon Mason <jon.mason@broadcom.com>
> Fixes: 98bc865a1ec8 ("net: mdio-mux: Add MDIO mux driver for iProc SoCs")
Applied and queued up for -stable.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web