Commit 705c7256 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'gpio-fixes-for-v6.8-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux

Pull gpio fixes from Bartosz Golaszewski:

 - fix resource freeing ordering in error path when adding a GPIO chip

 - only set pins to output after the reset is complete in gpio-74x164

* tag 'gpio-fixes-for-v6.8-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux:
  gpio: fix resource unwinding order in error path
  gpiolib: Fix the error path order in gpiochip_add_data_with_key()
  gpio: 74x164: Enable output pins after registers are reset
parents 7838b465 ec5c54a9
...@@ -127,8 +127,6 @@ static int gen_74x164_probe(struct spi_device *spi) ...@@ -127,8 +127,6 @@ static int gen_74x164_probe(struct spi_device *spi)
if (IS_ERR(chip->gpiod_oe)) if (IS_ERR(chip->gpiod_oe))
return PTR_ERR(chip->gpiod_oe); return PTR_ERR(chip->gpiod_oe);
gpiod_set_value_cansleep(chip->gpiod_oe, 1);
spi_set_drvdata(spi, chip); spi_set_drvdata(spi, chip);
chip->gpio_chip.label = spi->modalias; chip->gpio_chip.label = spi->modalias;
...@@ -153,6 +151,8 @@ static int gen_74x164_probe(struct spi_device *spi) ...@@ -153,6 +151,8 @@ static int gen_74x164_probe(struct spi_device *spi)
goto exit_destroy; goto exit_destroy;
} }
gpiod_set_value_cansleep(chip->gpiod_oe, 1);
ret = gpiochip_add_data(&chip->gpio_chip, chip); ret = gpiochip_add_data(&chip->gpio_chip, chip);
if (!ret) if (!ret)
return 0; return 0;
......
...@@ -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,13 +997,13 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data, ...@@ -997,13 +997,13 @@ 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);
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_remove_pin_ranges(gc);
gpiochip_free_valid_mask(gc); gpiochip_free_valid_mask(gc);
err_remove_from_list: err_remove_from_list:
spin_lock_irqsave(&gpio_lock, flags); spin_lock_irqsave(&gpio_lock, flags);
......
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