gpiolib: Fix the error path order in gpiochip_add_data_with_key()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Wed, 21 Feb 2024 19:28:46 +0000 (21:28 +0200)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Fri, 1 Mar 2024 07:36:53 +0000 (08:36 +0100)
After shuffling the code, error path wasn't updated correctly.
Fix it here.

Fixes: 2f4133bb5f14 ("gpiolib: No need to call gpiochip_remove_pin_ranges() twice")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
drivers/gpio/gpiolib.c

index e434e8cc1229c83ee86fe0ecd3a305c78fcccc4a..58a839c1ae48b293f80cb39682d4c795fa024e92 100644 (file)
@@ -999,11 +999,11 @@ err_remove_irqchip_mask:
        gpiochip_irqchip_free_valid_mask(gc);
 err_remove_acpi_chip:
        acpi_gpiochip_remove(gc);
+       gpiochip_remove_pin_ranges(gc);
 err_remove_of_chip:
        gpiochip_free_hogs(gc);
        of_gpiochip_remove(gc);
 err_free_gpiochip_mask:
-       gpiochip_remove_pin_ranges(gc);
        gpiochip_free_valid_mask(gc);
 err_remove_from_list:
        spin_lock_irqsave(&gpio_lock, flags);