net: netcp: add missing of_node_put() in netcp_probe()
authorWei Yongjun <weiyongjun1@huawei.com>
Sat, 22 Oct 2016 14:40:17 +0000 (14:40 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 26 Oct 2016 21:21:59 +0000 (17:21 -0400)
This node pointer is returned by of_get_child_by_name() 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 <weiyongjun1@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/ti/netcp_core.c

index 2fb5b6dd5231a4ccde1c3154eef98f96f2a6915d..78b4c831f5ad39757bebd9259ed8e259c292bc84 100644 (file)
@@ -2120,6 +2120,8 @@ static int netcp_probe(struct platform_device *pdev)
                }
        }
 
+       of_node_put(interfaces);
+
        /* Add the device instance to the list */
        list_add_tail(&netcp_device->device_list, &netcp_devices);
 
@@ -2132,6 +2134,8 @@ probe_quit_interface:
                netcp_delete_interface(netcp_device, netcp_intf->ndev);
        }
 
+       of_node_put(interfaces);
+
 probe_quit:
        pm_runtime_put_sync(&pdev->dev);
        pm_runtime_disable(&pdev->dev);