gpio: pca953x: Fix GPIO resource leak on Intel Galileo Gen 2
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 18 Jun 2020 11:49:06 +0000 (14:49 +0300)
committerBartosz Golaszewski <bgolaszewski@baylibre.com>
Mon, 22 Jun 2020 16:51:53 +0000 (18:51 +0200)
When adding a quirk for IRQ on Intel Galileo Gen 2 the commit ba8c90c61847
("gpio: pca953x: Override IRQ for one of the expanders on Galileo Gen 2")
missed GPIO resource release. We can safely do this in the same quirk, since
IRQ will be locked by GPIO framework when requested and unlocked on freeing.

Fixes: ba8c90c61847 ("gpio: pca953x: Override IRQ for one of the expanders on Galileo Gen 2")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
drivers/gpio/gpio-pca953x.c

index 6f409ee0b033c3be5d00c28a3106afcfc8d4d76b..a3b9bdedbe443503778ece0a4f85f4a47187dd6c 100644 (file)
@@ -176,7 +176,12 @@ static int pca953x_acpi_get_irq(struct device *dev)
        if (ret)
                return ret;
 
-       return gpio_to_irq(pin);
+       ret = gpio_to_irq(pin);
+
+       /* When pin is used as an IRQ, no need to keep it requested */
+       gpio_free(pin);
+
+       return ret;
 }
 #endif