summaryrefslogtreecommitdiff
path: root/net/dsa/dsa2.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/dsa/dsa2.c')
-rw-r--r--net/dsa/dsa2.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index ff2fa3950c62..9ef2caa13f27 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -874,12 +874,13 @@ static void dsa_switch_remove(struct dsa_switch *ds)
struct dsa_switch_tree *dst = ds->dst;
struct dsa_port *dp, *next;
+ dsa_tree_teardown(dst);
+
list_for_each_entry_safe(dp, next, &dst->ports, list) {
list_del(&dp->list);
kfree(dp);
}
- dsa_tree_teardown(dst);
dsa_tree_put(dst);
}