4ec8fe74bc7d7af5b6298308220c06f91228f6b6
[openwrt/staging/svanheule.git] /
1 From: Yang Yingliang <yangyingliang@huawei.com>
2 Date: Fri, 8 Apr 2022 11:22:46 +0800
3 Subject: [PATCH] net: ethernet: mtk_eth_soc: fix return value check in
4 mtk_wed_add_hw()
5
6 If syscon_regmap_lookup_by_phandle() fails, it never return NULL pointer,
7 change the check to IS_ERR().
8
9 Fixes: 804775dfc288 ("net: ethernet: mtk_eth_soc: add support for Wireless Ethernet Dispatch (WED)")
10 Reported-by: Hulk Robot <hulkci@huawei.com>
11 Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
12 Signed-off-by: David S. Miller <davem@davemloft.net>
13 ---
14
15 --- a/drivers/net/ethernet/mediatek/mtk_wed.c
16 +++ b/drivers/net/ethernet/mediatek/mtk_wed.c
17 @@ -816,7 +816,7 @@ void mtk_wed_add_hw(struct device_node *
18 return;
19
20 regs = syscon_regmap_lookup_by_phandle(np, NULL);
21 - if (!regs)
22 + if (IS_ERR(regs))
23 return;
24
25 rcu_assign_pointer(mtk_soc_wed_ops, &wed_ops);