Skip to content

Commit 0476189

Browse files
superna9999davem330
authored andcommitted
net: dsa: Fix cleanup resources upon module removal
The initial commit badly merged into the dsa_resume method instead of the dsa_remove_dst method. As consequence, the dst->master_netdev->dsa_ptr is not set to NULL on removal and re-bind of the dsa device fails with error -17. Fixes: b0dc635 ("net: dsa: cleanup resources upon module removal ") Signed-off-by: Neil Armstrong <[email protected]> Acked-by: Andrew Lunn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 88f09bd commit 0476189

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

net/dsa/dsa.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -935,6 +935,14 @@ static void dsa_remove_dst(struct dsa_switch_tree *dst)
935935
{
936936
int i;
937937

938+
dst->master_netdev->dsa_ptr = NULL;
939+
940+
/* If we used a tagging format that doesn't have an ethertype
941+
* field, make sure that all packets from this point get sent
942+
* without the tag and go through the regular receive path.
943+
*/
944+
wmb();
945+
938946
for (i = 0; i < dst->pd->nr_chips; i++) {
939947
struct dsa_switch *ds = dst->ds[i];
940948

@@ -988,14 +996,6 @@ static int dsa_suspend(struct device *d)
988996
struct dsa_switch_tree *dst = platform_get_drvdata(pdev);
989997
int i, ret = 0;
990998

991-
dst->master_netdev->dsa_ptr = NULL;
992-
993-
/* If we used a tagging format that doesn't have an ethertype
994-
* field, make sure that all packets from this point get sent
995-
* without the tag and go through the regular receive path.
996-
*/
997-
wmb();
998-
999999
for (i = 0; i < dst->pd->nr_chips; i++) {
10001000
struct dsa_switch *ds = dst->ds[i];
10011001

0 commit comments

Comments
 (0)