From patchwork Fri Apr 8 03:22:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Yingliang X-Patchwork-Id: 12806011 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F3979C433EF for ; Fri, 8 Apr 2022 03:15:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=KFiRQ8pNFnUMN6ZFUol9otG1qclEBgNrU7gO4OCBpMw=; b=OJ3YjLWy4Vh8Wl /PoIqvjd2981N8BXR8yUw9woGYuZiLtpoeFLRPACEs2xdE/1NU/ehy7sxJMADVC8g4aTwwW8cx/y/ YT2auproOOSAGfX0v0XeBkEjSqOXq9G6JpYoFXI6WXQYX3b4o8+iUjNN3jB8e/9RGPBWpI7rSgmm4 97TTu1So1PqvZzxjdGfr4RqCe7t3Yd66iLXC/eVkVGoVRP/Tc8KyU9D2GzdtlWcmak9cX9REZtfkg 47dMXCzxh8XgMTQvKsz3qBPwGHej2LXI8KRfmpTQtN/84R0y9Z39W425v+UINn0Wa2fprRAsRNhmy XpDz4rYOQSZnYIFU9RNw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ncf4Y-00Ekis-2q; Fri, 08 Apr 2022 03:14:06 +0000 Received: from szxga01-in.huawei.com ([45.249.212.187]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ncf4T-00Ekhq-Qm; Fri, 08 Apr 2022 03:14:03 +0000 Received: from dggpemm500020.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4KZNcQ5JmXzdZN3; Fri, 8 Apr 2022 11:13:26 +0800 (CST) Received: from dggpemm500007.china.huawei.com (7.185.36.183) by dggpemm500020.china.huawei.com (7.185.36.49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Fri, 8 Apr 2022 11:13:55 +0800 Received: from huawei.com (10.175.103.91) by dggpemm500007.china.huawei.com (7.185.36.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Fri, 8 Apr 2022 11:13:55 +0800 From: Yang Yingliang To: , , , CC: , Subject: [PATCH -next] net: ethernet: mtk_eth_soc: fix return value check in mtk_wed_add_hw() Date: Fri, 8 Apr 2022 11:22:46 +0800 Message-ID: <20220408032246.3089403-1-yangyingliang@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.175.103.91] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm500007.china.huawei.com (7.185.36.183) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220407_201402_073174_9DA10E1A X-CRM114-Status: UNSURE ( 9.21 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 --- 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 f0eacf819cd9..5d510ac24f2a 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);