mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
net: dsa: if ds->setup is true, ds->devlink is always non-NULL
Simplify dsa_switch_teardown() to remove the NULL checking for ds->devlink. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
5cf2c75b5b
commit
d95fa75061
1 changed files with 5 additions and 7 deletions
|
@ -682,8 +682,9 @@ static int dsa_switch_setup(struct dsa_switch *ds)
|
|||
goto free_slave_mii_bus;
|
||||
}
|
||||
|
||||
ds->setup = true;
|
||||
devlink_register(ds->devlink);
|
||||
|
||||
ds->setup = true;
|
||||
return 0;
|
||||
|
||||
free_slave_mii_bus:
|
||||
|
@ -705,8 +706,7 @@ static void dsa_switch_teardown(struct dsa_switch *ds)
|
|||
if (!ds->setup)
|
||||
return;
|
||||
|
||||
if (ds->devlink)
|
||||
devlink_unregister(ds->devlink);
|
||||
devlink_unregister(ds->devlink);
|
||||
|
||||
if (ds->slave_mii_bus && ds->ops->phy_read) {
|
||||
mdiobus_unregister(ds->slave_mii_bus);
|
||||
|
@ -721,10 +721,8 @@ static void dsa_switch_teardown(struct dsa_switch *ds)
|
|||
|
||||
dsa_switch_unregister_notifier(ds);
|
||||
|
||||
if (ds->devlink) {
|
||||
devlink_free(ds->devlink);
|
||||
ds->devlink = NULL;
|
||||
}
|
||||
devlink_free(ds->devlink);
|
||||
ds->devlink = NULL;
|
||||
|
||||
ds->setup = false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue