gpio: ftgpio010: Fix platform_get_irq's error checking
authorArvind Yadav <arvind.yadav.cs@gmail.com>
Sat, 2 Dec 2017 17:01:01 +0000 (22:31 +0530)
committerLinus Walleij <linus.walleij@linaro.org>
Sat, 2 Dec 2017 21:42:35 +0000 (22:42 +0100)
The platform_get_irq() function returns negative if an error occurs.
zero or positive number on success. platform_get_irq() error checking
for zero is not correct.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpio-ftgpio010.c

index 7b3394fdc624d17d24628f8a184dd6386b86ad87..b7a3a2db699b76c6abb2df04a6e28e23b3875d88 100644 (file)
@@ -176,8 +176,8 @@ static int ftgpio_gpio_probe(struct platform_device *pdev)
                return PTR_ERR(g->base);
 
        irq = platform_get_irq(pdev, 0);
-       if (!irq)
-               return -EINVAL;
+       if (irq <= 0)
+               return irq ? irq : -EINVAL;
 
        ret = bgpio_init(&g->gc, dev, 4,
                         g->base + GPIO_DATA_IN,