Skip to content

Commit 679fb46

Browse files
superna9999davem330
authored andcommitted
net: dsa: Add missing master netdev dev_put() calls
Upon probe failure or unbinding, add missing dev_put() calls. Signed-off-by: Neil Armstrong <narmstrong@baylibre.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent b0dc635 commit 679fb46

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

net/dsa/dsa.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -919,8 +919,10 @@ static int dsa_probe(struct platform_device *pdev)
919919
platform_set_drvdata(pdev, dst);
920920

921921
ret = dsa_setup_dst(dst, dev, &pdev->dev, pd);
922-
if (ret)
922+
if (ret) {
923+
dev_put(dev);
923924
goto out;
925+
}
924926

925927
return 0;
926928

@@ -940,6 +942,8 @@ static void dsa_remove_dst(struct dsa_switch_tree *dst)
940942
if (ds)
941943
dsa_switch_destroy(ds);
942944
}
945+
946+
dev_put(dst->master_netdev);
943947
}
944948

945949
static int dsa_remove(struct platform_device *pdev)

0 commit comments

Comments
 (0)