net: phy: Add missing of_node_put() in xgmiitorgmii_probe()
authorWei Yongjun <weiyj.lk@gmail.com>
Sun, 21 Aug 2016 22:46:15 +0000 (22:46 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 23 Aug 2016 01:07:47 +0000 (18:07 -0700)
This node pointer is returned by of_parse_phandle() with
refcount incremented in this function. of_node_put() on it
before exitting this function.

This is detected by Coccinelle semantic patch.

Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
Reviewed-by: Kedareswara rao Appana <appanad@xilinx.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/xilinx_gmii2rgmii.c

index e7a20ec2d8f724b4da2eced213e7a20f98e04879..f38be70943625fe143c3d178b130eea8c9442cba 100644 (file)
@@ -75,6 +75,7 @@ int xgmiitorgmii_probe(struct mdio_device *mdiodev)
        }
 
        priv->phy_dev = of_phy_find_device(phy_node);
+       of_node_put(phy_node);
        if (!priv->phy_dev) {
                dev_info(dev, "Couldn't find phydev\n");
                return -EPROBE_DEFER;