aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/qualcomm/emac/emac.c
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2016-11-24 19:21:31 +0100
committerDavid S. Miller <davem@davemloft.net>2016-11-27 20:01:15 -0500
commit6ffe1c4cd0a77f51d8d2985aa721d636b03ddf58 (patch)
tree0c8c0a6f7970c96c4827a06f9c0d0e19b9e62e48 /drivers/net/ethernet/qualcomm/emac/emac.c
parentnet: fsl/fman: fix fixed-link-phydev reference leak (diff)
downloadlinux-dev-6ffe1c4cd0a77f51d8d2985aa721d636b03ddf58.tar.xz
linux-dev-6ffe1c4cd0a77f51d8d2985aa721d636b03ddf58.zip
net: qcom/emac: fix of_node and phydev leaks
Make sure to drop the reference taken by of_phy_find_device() during probe on probe errors and on driver unbind. Also drop the of_node reference taken by of_parse_phandle() in the same path. Fixes: b9b17debc69d ("net: emac: emac gigabit ethernet controller driver") Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/qualcomm/emac/emac.c')
-rw-r--r--drivers/net/ethernet/qualcomm/emac/emac.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/net/ethernet/qualcomm/emac/emac.c b/drivers/net/ethernet/qualcomm/emac/emac.c
index 4fede4b86538..57b35aeac51a 100644
--- a/drivers/net/ethernet/qualcomm/emac/emac.c
+++ b/drivers/net/ethernet/qualcomm/emac/emac.c
@@ -711,6 +711,8 @@ static int emac_probe(struct platform_device *pdev)
err_undo_napi:
netif_napi_del(&adpt->rx_q.napi);
err_undo_mdiobus:
+ if (!has_acpi_companion(&pdev->dev))
+ put_device(&adpt->phydev->mdio.dev);
mdiobus_unregister(adpt->mii_bus);
err_undo_clocks:
emac_clks_teardown(adpt);
@@ -730,6 +732,8 @@ static int emac_remove(struct platform_device *pdev)
emac_clks_teardown(adpt);
+ if (!has_acpi_companion(&pdev->dev))
+ put_device(&adpt->phydev->mdio.dev);
mdiobus_unregister(adpt->mii_bus);
free_netdev(netdev);