net: mdio-mux: bcm-iproc: call mdiobus_free() in error path
authorJon Mason <jon.mason@broadcom.com>
Mon, 8 May 2017 21:48:35 +0000 (17:48 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 14 May 2017 12:08:29 +0000 (14:08 +0200)
commit8656ebcc28bc2a2338c1dc9a7f5de10c80e3cc1e
treeccb57d51ed73dbcc64fb9b0fd4bcc28014137ab8
parentc35107a3bec206f68402236a16be537b6ffce070
net: mdio-mux: bcm-iproc: call mdiobus_free() in error path

[ Upstream commit 922c60e89d52730050c6ccca218bff40cc8bcd8e ]

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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/phy/mdio-mux-bcm-iproc.c