diff options
author | Vladimir Oltean <vladimir.oltean@nxp.com> | 2022-11-21 15:55:42 +0200 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2022-11-22 20:41:47 -0800 |
commit | d95fa75061fbd09a7ae78a76bc8902a84b8538a5 (patch) | |
tree | 510c07d1482deffcf85ee3bba843daf54414c5fc /net/dsa | |
parent | 5cf2c75b5b91bcf81d61b2d2ea1c71363bcacf89 (diff) |
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>
Diffstat (limited to 'net/dsa')
-rw-r--r-- | net/dsa/dsa2.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c index 05e682c25590..f890dfcbf412 100644 --- a/net/dsa/dsa2.c +++ b/net/dsa/dsa2.c @@ -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; } |