ethernet: cavium: octeon: add missing of_node_put after calling of_parse_phandle
authorPeter Chen <peter.chen@nxp.com>
Mon, 1 Aug 2016 07:02:33 +0000 (15:02 +0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 2 Aug 2016 04:43:48 +0000 (21:43 -0700)
of_node_put needs to be called when the device node which is got
from of_parse_phandle has finished using.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/cavium/octeon/octeon_mgmt.c

index e8bc15bcde7096033ea697adf00dd74c1824437c..4ab404f45b215820245ed9f9ad478c7c3961d752 100644 (file)
@@ -1513,6 +1513,7 @@ static int octeon_mgmt_probe(struct platform_device *pdev)
        return 0;
 
 err:
+       of_node_put(p->phy_np);
        free_netdev(netdev);
        return result;
 }
@@ -1520,8 +1521,10 @@ err:
 static int octeon_mgmt_remove(struct platform_device *pdev)
 {
        struct net_device *netdev = platform_get_drvdata(pdev);
+       struct octeon_mgmt *p = netdev_priv(netdev);
 
        unregister_netdev(netdev);
+       of_node_put(p->phy_np);
        free_netdev(netdev);
        return 0;
 }