From patchwork Tue Aug 20 09:45:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinjie Ruan X-Patchwork-Id: 13769765 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 CA7FBC531DF for ; Tue, 20 Aug 2024 09:38:36 +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=DChpB2PkxB/2kszyRwYZ+wWNtU7F48IrENgjDpvpwVk=; b=0zn3hY77YDsO7N MD2dsm8ULfbdyjd3jlksYT1QabfV4VyTXqinxcxCQCFWAwjhHEW4f6esNQjD5ufB2prc2TV46C4Bb pX73r/k0uIpuNlfGmiAggdzfmk7mxP+YetHlU10u8lL5OvqYaSRvpcQARsfzUAXMozToa3Bjww/3U UzL5hOHijfe4e1gMHXm7SHTkkvRZENfmCvRtnVPXAViO4+4JZnFxBpiTpjVUiJNz4j4Jy1Yiujcla grPbHcNDRcGHy5NEgEjBkh9wCcgiTx+NtOc1lndP/m03WdpZkqHGWrWczdrwmHHPlK9w+jGfWYhlo ppseB8lEWqAxuYuIyxqA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgLJx-00000004c2H-2EFi; Tue, 20 Aug 2024 09:38:33 +0000 Received: from szxga06-in.huawei.com ([45.249.212.32]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgLJt-00000004c0b-2JpG for linux-riscv@lists.infradead.org; Tue, 20 Aug 2024 09:38:31 +0000 Received: from mail.maildlp.com (unknown [172.19.88.234]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4Wp4956yjKz1xvd6; Tue, 20 Aug 2024 17:36:25 +0800 (CST) Received: from kwepemh500013.china.huawei.com (unknown [7.202.181.146]) by mail.maildlp.com (Postfix) with ESMTPS id 093FE1400FD; Tue, 20 Aug 2024 17:38:20 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemh500013.china.huawei.com (7.202.181.146) 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 17:38:19 +0800 From: Jinjie Ruan To: , , , , , CC: Subject: [PATCH -next] irqchip/sifive-plic: Fix IS_ERR() vs NULL bug in plic_probe() Date: Tue, 20 Aug 2024 17:45:42 +0800 Message-ID: <20240820094542.1576537-1-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemh500013.china.huawei.com (7.202.181.146) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240820_023829_934008_720B26F3 X-CRM114-Status: UNSURE ( 9.52 ) X-CRM114-Notice: Please train this message. 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 The devm_platform_ioremap_resource() function returns error pointers. It never returns NULL. Update the check accordingly. Fixes: b68d0ff529a9 ("irqchip/sifive-plic: Use devm_xyz() for managed allocation") Cc: Signed-off-by: Jinjie Ruan Reviewed-by: Anup Patel --- drivers/irqchip/irq-sifive-plic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c index 9e22f7e378f5..cea8dca89c50 100644 --- a/drivers/irqchip/irq-sifive-plic.c +++ b/drivers/irqchip/irq-sifive-plic.c @@ -511,8 +511,8 @@ static int plic_probe(struct platform_device *pdev) priv->nr_irqs = nr_irqs; priv->regs = devm_platform_ioremap_resource(pdev, 0); - if (WARN_ON(!priv->regs)) - return -EIO; + if (WARN_ON(IS_ERR(priv->regs))) + return PTR_ERR(priv->regs); priv->prio_save = devm_bitmap_zalloc(dev, nr_irqs, GFP_KERNEL); if (!priv->prio_save)