net: dsa: call teardown method on probe failure
authorVladimir Oltean <vladimir.oltean@nxp.com>
Thu, 4 Feb 2021 16:33:51 +0000 (18:33 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Feb 2021 10:02:28 +0000 (11:02 +0100)
commitc930943a368336be15b909cc1d6c344eceb3bd5e
tree5930ad33d5a893d3baa07b844660da58d32fdd75
parent46a831d1cc25f559a5ef46aff35e39795b61a94c
net: dsa: call teardown method on probe failure

commit 8fd54a73b7cda11548154451bdb4bde6d8ff74c7 upstream.

Since teardown is supposed to undo the effects of the setup method, it
should be called in the error path for dsa_switch_setup, not just in
dsa_switch_teardown.

Fixes: 5e3f847a02aa ("net: dsa: Add teardown callback for drivers")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Link: https://lore.kernel.org/r/20210204163351.2929670-1-vladimir.oltean@nxp.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/dsa/dsa2.c