ef5374dcc574efe0cc87027eb058b4b72049d5f4
[openwrt/staging/blogic.git] /
1 From 9d4f20a476ca57e4c9246eb1fa2a61bea2354720 Mon Sep 17 00:00:00 2001
2 From: Yang Yingliang <yangyingliang@huawei.com>
3 Date: Mon, 17 Oct 2022 11:51:55 +0800
4 Subject: [PATCH 2/3] net: ethernet: mtk_eth_wed: add missing put_device() in
5 mtk_wed_add_hw()
6
7 After calling get_device() in mtk_wed_add_hw(), in error path, put_device()
8 needs be called.
9
10 Fixes: 804775dfc288 ("net: ethernet: mtk_eth_soc: add support for Wireless Ethernet Dispatch (WED)")
11 Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
12 Signed-off-by: David S. Miller <davem@davemloft.net>
13 ---
14 drivers/net/ethernet/mediatek/mtk_wed.c | 10 ++++++++--
15 1 file changed, 8 insertions(+), 2 deletions(-)
16
17 --- a/drivers/net/ethernet/mediatek/mtk_wed.c
18 +++ b/drivers/net/ethernet/mediatek/mtk_wed.c
19 @@ -1084,11 +1084,11 @@ void mtk_wed_add_hw(struct device_node *
20 get_device(&pdev->dev);
21 irq = platform_get_irq(pdev, 0);
22 if (irq < 0)
23 - return;
24 + goto err_put_device;
25
26 regs = syscon_regmap_lookup_by_phandle(np, NULL);
27 if (IS_ERR(regs))
28 - return;
29 + goto err_put_device;
30
31 rcu_assign_pointer(mtk_soc_wed_ops, &wed_ops);
32
33 @@ -1131,8 +1131,14 @@ void mtk_wed_add_hw(struct device_node *
34
35 hw_list[index] = hw;
36
37 + mutex_unlock(&hw_lock);
38 +
39 + return;
40 +
41 unlock:
42 mutex_unlock(&hw_lock);
43 +err_put_device:
44 + put_device(&pdev->dev);
45 }
46
47 void mtk_wed_exit(void)