Commit ec5c54a9 authored by Bartosz Golaszewski's avatar Bartosz Golaszewski

gpio: fix resource unwinding order in error path

Hogs are added *after* ACPI so should be removed *before* in error path.

Fixes: a411e81e ("gpiolib: add hogs support for machine code")
Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
parent e4aec4da
...@@ -968,11 +968,11 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data, ...@@ -968,11 +968,11 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,
ret = gpiochip_irqchip_init_valid_mask(gc); ret = gpiochip_irqchip_init_valid_mask(gc);
if (ret) if (ret)
goto err_remove_acpi_chip; goto err_free_hogs;
ret = gpiochip_irqchip_init_hw(gc); ret = gpiochip_irqchip_init_hw(gc);
if (ret) if (ret)
goto err_remove_acpi_chip; goto err_remove_irqchip_mask;
ret = gpiochip_add_irqchip(gc, lock_key, request_key); ret = gpiochip_add_irqchip(gc, lock_key, request_key);
if (ret) if (ret)
...@@ -997,11 +997,11 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data, ...@@ -997,11 +997,11 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,
gpiochip_irqchip_remove(gc); gpiochip_irqchip_remove(gc);
err_remove_irqchip_mask: err_remove_irqchip_mask:
gpiochip_irqchip_free_valid_mask(gc); gpiochip_irqchip_free_valid_mask(gc);
err_remove_acpi_chip: err_free_hogs:
gpiochip_free_hogs(gc);
acpi_gpiochip_remove(gc); acpi_gpiochip_remove(gc);
gpiochip_remove_pin_ranges(gc); gpiochip_remove_pin_ranges(gc);
err_remove_of_chip: err_remove_of_chip:
gpiochip_free_hogs(gc);
of_gpiochip_remove(gc); of_gpiochip_remove(gc);
err_free_gpiochip_mask: err_free_gpiochip_mask:
gpiochip_free_valid_mask(gc); gpiochip_free_valid_mask(gc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment