From patchwork Tue Aug 20 13:28:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yue Haibing X-Patchwork-Id: 13770107 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 5277FC3DA4A for ; Tue, 20 Aug 2024 13:34:41 +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=KFv9NaqSo6Eyu/dI+pKUZLBhPPq9KT4K+nI19I11pP8=; b=Ng3m+sXpObWOsU SFUU/BAspaiqAiUqbNso5piAeRhm/QDjGD19GlodT4m/o1leJEBFgZ0R80zufK4pP/ieEOzHzNipj xHZjrts6ETT0KZRW7Ll7URbrStSzAMlTMwKOkloPYdFNKlBs8wXLqCGFb/KjQG/by/I9LSYiMGjZK C4n92ZADWeadrluBu1wHDrS7V+yya/k/G4zkU34nmtQAt2WcbWyfhyUIiy5E1ipQ3ZZ8qV8j8YPsW EyX+a3StwM2xH4A/XVnuZE2FA+XUEow2zY88kNdMwU/fKJnZXK1VdP+rEBUObx/j0CmR7cNIHaaNI 3VCRfQrrgGg9XlKlnLGg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgP0P-00000005O8f-0bhO; Tue, 20 Aug 2024 13:34:37 +0000 Received: from szxga07-in.huawei.com ([45.249.212.35]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgP0I-00000005O7V-34OX for linux-riscv@lists.infradead.org; Tue, 20 Aug 2024 13:34:35 +0000 Received: from mail.maildlp.com (unknown [172.19.162.112]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4Wp9Rc32GDz1S8N7; Tue, 20 Aug 2024 21:34:20 +0800 (CST) Received: from dggpemf500002.china.huawei.com (unknown [7.185.36.57]) by mail.maildlp.com (Postfix) with ESMTPS id 2F78E1401F4; Tue, 20 Aug 2024 21:34:22 +0800 (CST) Received: from huawei.com (10.175.101.6) by dggpemf500002.china.huawei.com (7.185.36.57) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 20 Aug 2024 21:34:21 +0800 From: Yue Haibing To: , , , , , , CC: , , Subject: [PATCH -next] irqchip/riscv-aplic: Fix NULL vs IS_ERR() bug Date: Tue, 20 Aug 2024 21:28:57 +0800 Message-ID: <20240820132857.247679-1-yuehaibing@huawei.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.175.101.6] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemf500002.china.huawei.com (7.185.36.57) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240820_063433_384623_CF8EEE7F X-CRM114-Status: GOOD ( 10.51 ) X-BeenThere: linux-riscv@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-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org devm_platform_ioremap_resource() never returns NULL pointer, it will return ERR_PTR() when it fails, so check it with IS_ERR(). Fixes: 2333df5ae51e ("irqchip: Add RISC-V advanced PLIC driver for direct-mode") Signed-off-by: Yue Haibing --- drivers/irqchip/irq-riscv-aplic-main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/irqchip/irq-riscv-aplic-main.c b/drivers/irqchip/irq-riscv-aplic-main.c index 28dd175b5764..6d93a85f1fc6 100644 --- a/drivers/irqchip/irq-riscv-aplic-main.c +++ b/drivers/irqchip/irq-riscv-aplic-main.c @@ -175,9 +175,9 @@ static int aplic_probe(struct platform_device *pdev) /* Map the MMIO registers */ regs = devm_platform_ioremap_resource(pdev, 0); - if (!regs) { + if (IS_ERR(regs)) dev_err(dev, "failed map MMIO registers\n"); - return -ENOMEM; + return PTR_ERR(regs); } /*