Skip to contentSkip to conversation

gpio: idt3243x: Fix IRQ check in idt_gpio_probe

PATCH Applied Miaoqian Lin 3 participants 3 messages Jan 14, 2022 – Jan 17, 2022 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio: idt3243x: Fix IRQ check in idt_gpio_probe

platform_get_irq() returns negative error number instead 0 on failure. And the doc of platform_get_irq() provides a usage example:

    int irq = platform_get_irq(pdev, 0);
    if (irq < 0)
        return irq;

Fix the check of return value to catch errors correctly.

Fixes 4195926aedca ("gpio: Add support for IDT 79RC3243x GPIO controller")
---
 drivers/gpio/gpio-idt3243x.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/gpio-idt3243x.c +2 -2
index 50003ad2e589..08493b05be2d 100644
@@ -164,8 +164,8 @@ static int idt_gpio_probe(struct platform_device *pdev)
 			return PTR_ERR(ctrl->pic);
 
 		parent_irq = platform_get_irq(pdev, 0);
-		if (!parent_irq)
-			return -EINVAL;
+		if (parent_irq < 0)
+			return parent_irq;
 
 		girq = &ctrl->gc.irq;
 		girq->chip = &idt_gpio_irqchip;
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Miaoqian Lin

platform_get_irq() returns negative error number instead 0 on failure. And the doc of platform_get_irq() provides a usage example:

    int irq = platform_get_irq(pdev, 0);
    if (irq < 0)
        return irq;

Fix the check of return value to catch errors correctly.

Fixes 4195926aedca ("gpio: Add support for IDT 79RC3243x GPIO controller")

Yours,
Linus Walleij

#2 lore raw
In reply to Miaoqian Lin
Quoted 32 lines · Miaoqian Lin

platform_get_irq() returns negative error number instead 0 on failure. And the doc of platform_get_irq() provides a usage example:

    int irq = platform_get_irq(pdev, 0);
    if (irq < 0)
        return irq;

Fix the check of return value to catch errors correctly.

Fixes 4195926aedca ("gpio: Add support for IDT 79RC3243x GPIO controller")
---
 drivers/gpio/gpio-idt3243x.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/gpio-idt3243x.c +2 -3
index 50003ad2e589..08493b05be2d 100644
@@ -164,8 +164,8 @@ static int idt_gpio_probe(struct platform_device *pdev)
                        return PTR_ERR(ctrl->pic);
 
                parent_irq = platform_get_irq(pdev, 0);
-               if (!parent_irq)
-                       return -EINVAL;
+               if (parent_irq < 0)
+                       return parent_irq;
 
                girq = &ctrl->gc.irq;
                girq->chip = &idt_gpio_irqchip;
--
Quoted 2 lines

2.17.1

Queued for fixes, thanks!

Bart