[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK9=C2UMsvb=mZHks+c-YBsWO23=WSrKj3=GgFiO9wzQwc_XLw@mail.gmail.com>
Date: Tue, 20 Aug 2024 19:45:14 +0530
From: Anup Patel <apatel@...tanamicro.com>
To: Yue Haibing <yuehaibing@...wei.com>
Cc: anup@...infault.org, tglx@...utronix.de, paul.walmsley@...ive.com,
palmer@...belt.com, aou@...s.berkeley.edu, ruanjinjie@...wei.com,
bjorn@...osinc.com, linux-riscv@...ts.infradead.org,
linux-kernel@...r.kernel.org, dan.carpenter@...aro.org
Subject: Re: [PATCH -next] irqchip/riscv-aplic: Fix NULL vs IS_ERR() bug
On Tue, Aug 20, 2024 at 7:04 PM Yue Haibing <yuehaibing@...wei.com> wrote:
>
> 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@...wei.com>
Dan (CC'ed) already posted a very similar patch.
Regards,
Anup
> ---
> 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
>
>
Powered by blists - more mailing lists