Skip to content

Commit 6dbbf84

Browse files
Edmond Chungbrgl
authored andcommitted
gpiolib: Don't free if pin ranges are not defined
A similar check was added in gpiochip_generic_request, but not in free. This has caused an imbalance count of request vs. free calls to the pinctrl driver. This patch is targeted to fix that issue. Fixes: 2ab73c6 ("gpio: Support GPIO controllers without pin-ranges") Signed-off-by: Edmond Chung <edmondchung@google.com> Signed-off-by: Andrew Chant <achant@google.com> Signed-off-by: Will McVicker <willmcvicker@google.com> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
1 parent 60593df commit 6dbbf84

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

drivers/gpio/gpiolib.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1806,6 +1806,11 @@ EXPORT_SYMBOL_GPL(gpiochip_generic_request);
18061806
*/
18071807
void gpiochip_generic_free(struct gpio_chip *gc, unsigned offset)
18081808
{
1809+
#ifdef CONFIG_PINCTRL
1810+
if (list_empty(&gc->gpiodev->pin_ranges))
1811+
return;
1812+
#endif
1813+
18091814
pinctrl_gpio_free(gc->gpiodev->base + offset);
18101815
}
18111816
EXPORT_SYMBOL_GPL(gpiochip_generic_free);

0 commit comments

Comments
 (0)