public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] irqchip/riscv-aplic: Fix NULL vs IS_ERR() bug
@ 2024-08-20 13:28 Yue Haibing
  2024-08-20 14:15 ` Anup Patel
  2024-08-22 21:36 ` kernel test robot
  0 siblings, 2 replies; 3+ messages in thread
From: Yue Haibing @ 2024-08-20 13:28 UTC (permalink / raw)
  To: anup, tglx, paul.walmsley, palmer, aou, ruanjinjie, bjorn
  Cc: linux-riscv, linux-kernel, yuehaibing

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 <yuehaibing@huawei.com>
---
 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);
 	}
 
 	/*
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-08-22 21:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-20 13:28 [PATCH -next] irqchip/riscv-aplic: Fix NULL vs IS_ERR() bug Yue Haibing
2024-08-20 14:15 ` Anup Patel
2024-08-22 21:36 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox