net: dsa: mv88e6xxx: Unregister MDIO bus on error path
authorAndrew Lunn <andrew@lunn.ch>
Thu, 7 Dec 2017 00:05:57 +0000 (01:05 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 25 Feb 2018 10:08:00 +0000 (11:08 +0100)
commit9c65a55722acf228bdf194954fe02084c1f1eeb1
treea1087ff4681a7df41339397be9bf16519218c67d
parent0ef99ba03888ea4be143d0a9e9b401071d0fcbf8
net: dsa: mv88e6xxx: Unregister MDIO bus on error path

[ Upstream commit 3126aeec5313565bfa19e2dd8fd7e3c3390514cb ]

The MDIO busses need to be unregistered before they are freed,
otherwise BUG() is called. Add a call to the unregister code if the
registration fails, since we can have multiple busses, of which some
may correctly register before one fails. This requires moving the code
around a little.

Fixes: a3c53be55c95 ("net: dsa: mv88e6xxx: Support multiple MDIO busses")
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/dsa/mv88e6xxx/chip.c