[PATCH] irqchip/riscv-aplic: Fix an IS_ERR() vs NULL bug in probe()

Anup Patel anup at brainfault.org
Tue Aug 20 02:19:31 PDT 2024


On Tue, Aug 20, 2024 at 2:12 PM Dan Carpenter <dan.carpenter at linaro.org> wrote:
>
> The devm_platform_ioremap_resource() function doesn't return NULL, it
> returns error pointers.  Fix the error handling to match.
>
> Fixes: 2333df5ae51e ("irqchip: Add RISC-V advanced PLIC driver for direct-mode")
> Signed-off-by: Dan Carpenter <dan.carpenter at linaro.org>

LGTM.

Reviewed-by: Anup Patel <anup at brainfault.org>

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..981fad6fb8f7 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.43.0
>



More information about the linux-riscv mailing list