[PATCH net-next] net: dsa: unregister cross-chip notifier after ds->ops->teardown
From: Vladimir Oltean <vladimir.oltean@nxp.com>
Date: 2021-10-12 12:39:14
To be symmetric with the error unwind path of dsa_switch_setup(), call dsa_switch_unregister_notifier() after ds->ops->teardown. The implication is that ds->ops->teardown cannot emit cross-chip notifiers. For example, currently the dsa_tag_8021q_unregister() call from sja1105_teardown() does not propagate to the entire tree due to this reason. However I cannot find an actual issue caused by this, observed using code inspection. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> --- net/dsa/dsa2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index 58f7dce0652c..4f92b1042dd3 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c@@ -948,11 +948,11 @@ static void dsa_switch_teardown(struct dsa_switch *ds) ds->slave_mii_bus = NULL; } - dsa_switch_unregister_notifier(ds); - if (ds->ops->teardown) ds->ops->teardown(ds); + dsa_switch_unregister_notifier(ds); + if (ds->devlink) { list_for_each_entry(dp, &ds->dst->ports, list) if (dp->ds == ds)
--
2.25.1