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>
This commit is contained in:
Neil Armstrong 2015-12-07 13:57:34 +01:00 committed by David S. Miller
parent b0dc635d92
commit 679fb46c57

View file

@ -919,8 +919,10 @@ static int dsa_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, dst); platform_set_drvdata(pdev, dst);
ret = dsa_setup_dst(dst, dev, &pdev->dev, pd); ret = dsa_setup_dst(dst, dev, &pdev->dev, pd);
if (ret) if (ret) {
dev_put(dev);
goto out; goto out;
}
return 0; return 0;
@ -940,6 +942,8 @@ static void dsa_remove_dst(struct dsa_switch_tree *dst)
if (ds) if (ds)
dsa_switch_destroy(ds); dsa_switch_destroy(ds);
} }
dev_put(dst->master_netdev);
} }
static int dsa_remove(struct platform_device *pdev) static int dsa_remove(struct platform_device *pdev)