public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mfd: fix error check return value of platform_get_irq()
@ 2022-04-12  8:53 cgel.zte
  2022-04-12 13:46 ` Linus Walleij
  2022-04-26 14:12 ` Lee Jones
  0 siblings, 2 replies; 3+ messages in thread
From: cgel.zte @ 2022-04-12  8:53 UTC (permalink / raw)
  To: lee.jones, gremlin
  Cc: gregkh, mad_soft, linus.walleij, linux-kernel, Lv Ruyi,
	Zeal Robot

From: Lv Ruyi <lv.ruyi@zte.com.cn>

platform_get_irq() return negative value on failure, so null check of
irq is incorrect. Fix it by comparing whether it is less than zero.

Fixes: dcc21cc09e3c ("mfd: Add driver for Atmel Microcontroller on iPaq h3xxx")
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>
---
 drivers/mfd/ipaq-micro.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mfd/ipaq-micro.c b/drivers/mfd/ipaq-micro.c
index e92eeeb67a98..4cd5ecc72211 100644
--- a/drivers/mfd/ipaq-micro.c
+++ b/drivers/mfd/ipaq-micro.c
@@ -403,7 +403,7 @@ static int __init micro_probe(struct platform_device *pdev)
 	micro_reset_comm(micro);
 
 	irq = platform_get_irq(pdev, 0);
-	if (!irq)
+	if (irq < 0)
 		return -EINVAL;
 	ret = devm_request_irq(&pdev->dev, irq, micro_serial_isr,
 			       IRQF_SHARED, "ipaq-micro",
-- 
2.25.1


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

* Re: [PATCH] mfd: fix error check return value of platform_get_irq()
  2022-04-12  8:53 [PATCH] mfd: fix error check return value of platform_get_irq() cgel.zte
@ 2022-04-12 13:46 ` Linus Walleij
  2022-04-26 14:12 ` Lee Jones
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2022-04-12 13:46 UTC (permalink / raw)
  To: cgel.zte
  Cc: lee.jones, gremlin, gregkh, mad_soft, linux-kernel, Lv Ruyi,
	Zeal Robot

On Tue, Apr 12, 2022 at 10:53 AM <cgel.zte@gmail.com> wrote:

> From: Lv Ruyi <lv.ruyi@zte.com.cn>
>
> platform_get_irq() return negative value on failure, so null check of
> irq is incorrect. Fix it by comparing whether it is less than zero.
>
> Fixes: dcc21cc09e3c ("mfd: Add driver for Atmel Microcontroller on iPaq h3xxx")
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

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

* Re: [PATCH] mfd: fix error check return value of platform_get_irq()
  2022-04-12  8:53 [PATCH] mfd: fix error check return value of platform_get_irq() cgel.zte
  2022-04-12 13:46 ` Linus Walleij
@ 2022-04-26 14:12 ` Lee Jones
  1 sibling, 0 replies; 3+ messages in thread
From: Lee Jones @ 2022-04-26 14:12 UTC (permalink / raw)
  To: cgel.zte
  Cc: gremlin, gregkh, mad_soft, linus.walleij, linux-kernel, Lv Ruyi,
	Zeal Robot

On Tue, 12 Apr 2022, cgel.zte@gmail.com wrote:

> From: Lv Ruyi <lv.ruyi@zte.com.cn>
> 
> platform_get_irq() return negative value on failure, so null check of
> irq is incorrect. Fix it by comparing whether it is less than zero.
> 
> Fixes: dcc21cc09e3c ("mfd: Add driver for Atmel Microcontroller on iPaq h3xxx")
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>
> ---
>  drivers/mfd/ipaq-micro.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

I fixed the subject line for you and applied, thanks.

-- 
Lee Jones [李琼斯]
Principal Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

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

end of thread, other threads:[~2022-04-26 14:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-12  8:53 [PATCH] mfd: fix error check return value of platform_get_irq() cgel.zte
2022-04-12 13:46 ` Linus Walleij
2022-04-26 14:12 ` Lee Jones

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