Commit e0bb4659 authored by Yang Yingliang's avatar Yang Yingliang Committed by David S. Miller

net: ethernet: mtk_eth_wed: add missing of_node_put()

The device_node pointer returned by of_parse_phandle() with refcount
incremented, when finish using it, the refcount need be decreased.

Fixes: 804775df ("net: ethernet: mtk_eth_soc: add support for Wireless Ethernet Dispatch (WED)")
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9d4f20a4
...@@ -1072,7 +1072,7 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth, ...@@ -1072,7 +1072,7 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth,
pdev = of_find_device_by_node(np); pdev = of_find_device_by_node(np);
if (!pdev) if (!pdev)
return; goto err_of_node_put;
get_device(&pdev->dev); get_device(&pdev->dev);
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(pdev, 0);
...@@ -1132,6 +1132,8 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth, ...@@ -1132,6 +1132,8 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth,
mutex_unlock(&hw_lock); mutex_unlock(&hw_lock);
err_put_device: err_put_device:
put_device(&pdev->dev); put_device(&pdev->dev);
err_of_node_put:
of_node_put(np);
} }
void mtk_wed_exit(void) void mtk_wed_exit(void)
...@@ -1152,6 +1154,7 @@ void mtk_wed_exit(void) ...@@ -1152,6 +1154,7 @@ void mtk_wed_exit(void)
hw_list[i] = NULL; hw_list[i] = NULL;
debugfs_remove(hw->debugfs_dir); debugfs_remove(hw->debugfs_dir);
put_device(hw->dev); put_device(hw->dev);
of_node_put(hw->node);
kfree(hw); kfree(hw);
} }
} }
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