gpio: vr41xx: Bail out on gpiochip_lock_as_irq() error
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 30 Jul 2018 12:38:37 +0000 (15:38 +0300)
committerLinus Walleij <linus.walleij@linaro.org>
Mon, 6 Aug 2018 21:46:55 +0000 (23:46 +0200)
gpiochip_lock_as_irq() may return a few error codes,
bail out if it fails with corresponding returned code.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpio-vr41xx.c

index ac8deb01f6f63b274f3e496e61ec99b53e485e6d..027699cec911b5df7d963d61479e80da17f58b39 100644 (file)
@@ -138,10 +138,16 @@ static void unmask_giuint_low(struct irq_data *d)
 
 static unsigned int startup_giuint(struct irq_data *data)
 {
-       if (gpiochip_lock_as_irq(&vr41xx_gpio_chip, data->hwirq))
+       int ret;
+
+       ret = gpiochip_lock_as_irq(&vr41xx_gpio_chip, irqd_to_hwirq(data));
+       if (ret) {
                dev_err(vr41xx_gpio_chip.parent,
                        "unable to lock HW IRQ %lu for IRQ\n",
                        data->hwirq);
+               return ret;
+       }
+
        /* Satisfy the .enable semantics by unmasking the line */
        unmask_giuint_low(data);
        return 0;