]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
gpio: fix cleanup path on hog failure
authorBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Tue, 9 Jun 2026 12:17:50 +0000 (14:17 +0200)
committerBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Wed, 10 Jun 2026 07:29:19 +0000 (09:29 +0200)
If gpiochip_hog_lines() successfully processes some hogs but fails on
a later one, the error handling path in gpiochip_add_data_with_key()
jumps directly to err_remove_of_chip. This leaks resources allocated
earlier for ACPI, interrupts and hogs that were successfully processed.
Use the right label in error path.

Closes: https://sashiko.dev/#/patchset/20260608210108.36248-1-dan%40reactivated.net
Fixes: d1d564ec4992 ("gpio: move hogs into GPIO core")
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Link: https://patch.msgid.link/20260609-gpio-hogs-fixes-v1-2-b4064f8070e7@oss.qualcomm.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
drivers/gpio/gpiolib.c

index 1e6dce430dca059fc1f92dfe948d7916c84a515e..d3e0d77f74e7ae23d496ea0ef04dbf0beec4ec17 100644 (file)
@@ -1291,7 +1291,7 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,
 
        ret = gpiochip_hog_lines(gc);
        if (ret)
-               goto err_remove_of_chip;
+               goto err_free_hogs;
 
        ret = gpiochip_irqchip_init_valid_mask(gc);
        if (ret)