Commit 829c6524 authored by Xiang Yang's avatar Xiang Yang Committed by David S. Miller

net: pcs: Add missing put_device call in miic_create

The reference of pdev->dev is taken by of_find_device_by_node, so
it should be released when not need anymore.

Fixes: 7dc54d3b ("net: pcs: add Renesas MII converter driver")
Signed-off-by: default avatarXiang Yang <xiangyang3@huawei.com>
Reviewed-by: default avatarVladimir Oltean <olteanv@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 51b81317
......@@ -313,15 +313,21 @@ struct phylink_pcs *miic_create(struct device *dev, struct device_node *np)
pdev = of_find_device_by_node(pcs_np);
of_node_put(pcs_np);
if (!pdev || !platform_get_drvdata(pdev))
if (!pdev || !platform_get_drvdata(pdev)) {
if (pdev)
put_device(&pdev->dev);
return ERR_PTR(-EPROBE_DEFER);
}
miic_port = kzalloc(sizeof(*miic_port), GFP_KERNEL);
if (!miic_port)
if (!miic_port) {
put_device(&pdev->dev);
return ERR_PTR(-ENOMEM);
}
miic = platform_get_drvdata(pdev);
device_link_add(dev, miic->dev, DL_FLAG_AUTOREMOVE_CONSUMER);
put_device(&pdev->dev);
miic_port->miic = miic;
miic_port->port = port - 1;
......
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