From b559edfaf3f3f3eb726f99f65b181ab310b3d4bc Mon Sep 17 00:00:00 2001 From: Yang Yingliang Date: Fri, 8 Apr 2022 11:22:46 +0800 Subject: [PATCH] net: ethernet: mtk_eth_soc: fix return value check in mtk_wed_add_hw() If syscon_regmap_lookup_by_phandle() fails, it never return NULL pointer, change the check to IS_ERR(). Fixes: 804775dfc288 ("net: ethernet: mtk_eth_soc: add support for Wireless Ethernet Dispatch (WED)") Reported-by: Hulk Robot Signed-off-by: Yang Yingliang Signed-off-by: David S. Miller --- drivers/net/ethernet/mediatek/mtk_wed.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mediatek/mtk_wed.c b/drivers/net/ethernet/mediatek/mtk_wed.c index f0eacf8..5d510ac 100644 --- a/drivers/net/ethernet/mediatek/mtk_wed.c +++ b/drivers/net/ethernet/mediatek/mtk_wed.c @@ -813,7 +813,7 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth, return; regs = syscon_regmap_lookup_by_phandle(np, NULL); - if (!regs) + if (IS_ERR(regs)) return; rcu_assign_pointer(mtk_soc_wed_ops, &wed_ops); -- 2.7.4