mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-15 15:15:47 +00:00
net: dsa: call teardown method on probe failure
commit8fd54a73b7
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:5e3f847a02
("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>
This commit is contained in:
parent
0b42ab0783
commit
5c53956a8d
1 changed files with 5 additions and 2 deletions
|
@ -399,18 +399,21 @@ static int dsa_switch_setup(struct dsa_switch *ds)
|
|||
ds->slave_mii_bus = devm_mdiobus_alloc(ds->dev);
|
||||
if (!ds->slave_mii_bus) {
|
||||
err = -ENOMEM;
|
||||
goto unregister_notifier;
|
||||
goto teardown;
|
||||
}
|
||||
|
||||
dsa_slave_mii_bus_init(ds);
|
||||
|
||||
err = mdiobus_register(ds->slave_mii_bus);
|
||||
if (err < 0)
|
||||
goto unregister_notifier;
|
||||
goto teardown;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
teardown:
|
||||
if (ds->ops->teardown)
|
||||
ds->ops->teardown(ds);
|
||||
unregister_notifier:
|
||||
dsa_switch_unregister_notifier(ds);
|
||||
unregister_devlink:
|
||||
|
|
Loading…
Reference in a new issue