Commit 9e081031 authored by Johan Hovold's avatar Johan Hovold Committed by David S. Miller

net: ethernet: aurora: nb8800: fix fixed-link phydev leaks

Make sure to deregister and free any fixed-link PHY registered using
of_phy_register_fixed_link() on probe errors and on driver unbind.

Fixes: c7dfe3ab ("net: ethernet: nb8800: support fixed-link DT
node")
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5a89394a
...@@ -1466,12 +1466,12 @@ static int nb8800_probe(struct platform_device *pdev) ...@@ -1466,12 +1466,12 @@ static int nb8800_probe(struct platform_device *pdev)
ret = nb8800_hw_init(dev); ret = nb8800_hw_init(dev);
if (ret) if (ret)
goto err_free_bus; goto err_deregister_fixed_link;
if (ops && ops->init) { if (ops && ops->init) {
ret = ops->init(dev); ret = ops->init(dev);
if (ret) if (ret)
goto err_free_bus; goto err_deregister_fixed_link;
} }
dev->netdev_ops = &nb8800_netdev_ops; dev->netdev_ops = &nb8800_netdev_ops;
...@@ -1504,6 +1504,9 @@ static int nb8800_probe(struct platform_device *pdev) ...@@ -1504,6 +1504,9 @@ static int nb8800_probe(struct platform_device *pdev)
err_free_dma: err_free_dma:
nb8800_dma_free(dev); nb8800_dma_free(dev);
err_deregister_fixed_link:
if (of_phy_is_fixed_link(pdev->dev.of_node))
of_phy_deregister_fixed_link(pdev->dev.of_node);
err_free_bus: err_free_bus:
of_node_put(priv->phy_node); of_node_put(priv->phy_node);
mdiobus_unregister(bus); mdiobus_unregister(bus);
...@@ -1521,6 +1524,8 @@ static int nb8800_remove(struct platform_device *pdev) ...@@ -1521,6 +1524,8 @@ static int nb8800_remove(struct platform_device *pdev)
struct nb8800_priv *priv = netdev_priv(ndev); struct nb8800_priv *priv = netdev_priv(ndev);
unregister_netdev(ndev); unregister_netdev(ndev);
if (of_phy_is_fixed_link(pdev->dev.of_node))
of_phy_deregister_fixed_link(pdev->dev.of_node);
of_node_put(priv->phy_node); of_node_put(priv->phy_node);
mdiobus_unregister(priv->mii_bus); mdiobus_unregister(priv->mii_bus);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment