0a452d4a7d46a535afe0751d6db38248ad324560
[openwrt/staging/ldir.git] /
1 From e0bb4659e235770e6f53b3692e958591f49448f5 Mon Sep 17 00:00:00 2001
2 From: Yang Yingliang <yangyingliang@huawei.com>
3 Date: Mon, 17 Oct 2022 11:51:56 +0800
4 Subject: [PATCH 3/3] net: ethernet: mtk_eth_wed: add missing of_node_put()
5
6 The device_node pointer returned by of_parse_phandle() with refcount
7 incremented, when finish using it, the refcount need be decreased.
8
9 Fixes: 804775dfc288 ("net: ethernet: mtk_eth_soc: add support for Wireless Ethernet Dispatch (WED)")
10 Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
11 Signed-off-by: David S. Miller <davem@davemloft.net>
12 ---
13 drivers/net/ethernet/mediatek/mtk_wed.c | 5 ++++-
14 1 file changed, 4 insertions(+), 1 deletion(-)
15
16 --- a/drivers/net/ethernet/mediatek/mtk_wed.c
17 +++ b/drivers/net/ethernet/mediatek/mtk_wed.c
18 @@ -1079,7 +1079,7 @@ void mtk_wed_add_hw(struct device_node *
19
20 pdev = of_find_device_by_node(np);
21 if (!pdev)
22 - return;
23 + goto err_of_node_put;
24
25 get_device(&pdev->dev);
26 irq = platform_get_irq(pdev, 0);
27 @@ -1139,6 +1139,8 @@ unlock:
28 mutex_unlock(&hw_lock);
29 err_put_device:
30 put_device(&pdev->dev);
31 +err_of_node_put:
32 + of_node_put(np);
33 }
34
35 void mtk_wed_exit(void)
36 @@ -1159,6 +1161,7 @@ void mtk_wed_exit(void)
37 hw_list[i] = NULL;
38 debugfs_remove(hw->debugfs_dir);
39 put_device(hw->dev);
40 + of_node_put(hw->node);
41 kfree(hw);
42 }
43 }