linux-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] irqchip/sifive-plic: Fix IS_ERR() vs NULL bug in plic_probe()
@ 2024-08-20  9:45 Jinjie Ruan
  2024-08-20 11:04 ` Anup Patel
  2024-08-20 15:04 ` Thomas Gleixner
  0 siblings, 2 replies; 3+ messages in thread
From: Jinjie Ruan @ 2024-08-20  9:45 UTC (permalink / raw)
  To: tglx, paul.walmsley, samuel.holland, apatel, linux-kernel,
	linux-riscv
  Cc: ruanjinjie

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: <stable@vger.kernel.org>
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
 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)
-- 
2.34.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: [PATCH -next] irqchip/sifive-plic: Fix IS_ERR() vs NULL bug in plic_probe()
  2024-08-20  9:45 [PATCH -next] irqchip/sifive-plic: Fix IS_ERR() vs NULL bug in plic_probe() Jinjie Ruan
@ 2024-08-20 11:04 ` Anup Patel
  2024-08-20 15:04 ` Thomas Gleixner
  1 sibling, 0 replies; 3+ messages in thread
From: Anup Patel @ 2024-08-20 11:04 UTC (permalink / raw)
  To: Jinjie Ruan
  Cc: tglx, paul.walmsley, samuel.holland, apatel, linux-kernel,
	linux-riscv

On Tue, Aug 20, 2024 at 3:09 PM Jinjie Ruan <ruanjinjie@huawei.com> wrote:
>
> 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: <stable@vger.kernel.org>
> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>

LGTM.

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

Regards,
Anup

> ---
>  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)
> --
> 2.34.1
>
>

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: [PATCH -next] irqchip/sifive-plic: Fix IS_ERR() vs NULL bug in plic_probe()
  2024-08-20  9:45 [PATCH -next] irqchip/sifive-plic: Fix IS_ERR() vs NULL bug in plic_probe() Jinjie Ruan
  2024-08-20 11:04 ` Anup Patel
@ 2024-08-20 15:04 ` Thomas Gleixner
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Gleixner @ 2024-08-20 15:04 UTC (permalink / raw)
  To: Jinjie Ruan, paul.walmsley, samuel.holland, apatel, linux-kernel,
	linux-riscv
  Cc: ruanjinjie

On Tue, Aug 20 2024 at 17:45, Jinjie Ruan wrote:
> 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: <stable@vger.kernel.org>
> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
> ---
>  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);

This is obsolete by now:

https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?h=irq/urgent&id=4d936f10ff80274841537a26d1fbfe9984de0ef9

Thanks,

        tglx

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

end of thread, other threads:[~2024-08-20 15:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-20  9:45 [PATCH -next] irqchip/sifive-plic: Fix IS_ERR() vs NULL bug in plic_probe() Jinjie Ruan
2024-08-20 11:04 ` Anup Patel
2024-08-20 15:04 ` Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).