net: dsa: Unregister slave_dev in error path
authorFlorian Fainelli <f.fainelli@gmail.com>
Thu, 18 Feb 2016 02:43:22 +0000 (18:43 -0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 18 Feb 2016 03:05:16 +0000 (22:05 -0500)
commit73dcb556538a4192222c3a919a51e1701bae553b
tree00d6bc3876542be3b76ef7d9fd0c0042515ffacb
parent79be1a1c9090048f6f327204b8b1cf4ac067b487
net: dsa: Unregister slave_dev in error path

With commit 0071f56e46da ("dsa: Register netdev before phy"), we are now trying
to free a network device that has been previously registered, and in case of
errors, this will make us hit the BUG_ON(dev->reg_state != NETREG_UNREGISTERED)
condition.

Fix this by adding a missing unregister_netdev() before free_netdev().

Fixes: 0071f56e46da ("dsa: Register netdev before phy")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/dsa/slave.c