Skip to content

Commit

Permalink
net: mdio-mux: bcm-iproc: call mdiobus_free() in error path
Browse files Browse the repository at this point in the history
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: 98bc865 ("net: mdio-mux: Add MDIO mux driver for iProc SoCs")
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jon Mason authored and David S. Miller committed May 8, 2017
1 parent 48f5bcc commit 922c60e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/net/phy/mdio-mux-bcm-iproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 922c60e

Please sign in to comment.