gpio fixes for v6.8-rc7

- 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
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEFp3rbAvDxGAT0sefEacuoBRx13IFAmXjAFQACgkQEacuoBRx
 13JQDhAAiRnE6kYITVWr4O581UpyC9v9yp0Yo6mVeUCHIGKkmZnKrBqcDjORo4Qg
 zmpeot5W7zmYQfMy/cjzyo/rSi55mKb3wAyA4/BHScz4SwUyWJrNjkx5WIQgJssW
 85ZA7x5G6qptf+4oGqSTVG8G6Q/7uR3s+VKgVVWETT31DomPv6DUXFJj1Eu6HNyG
 M25hZvBu8tWMTc6p/rPYcASMYYNrmHDpoETQwrBeESS2kvDIyvoTaTYAFttOOYUN
 aB9UyoW1e4KFQ/tppQwdpBEpGWLLHzR/dMnyV20pUW3OIuToSwQ2HdDRGx4Wnco4
 fImfVqeg4n8DHay43mlr/eSO65CrrngJdhwrB5415wSU6mMkRvd6A12mEWXU0Mjh
 UGiqBI3jxQBPW2tQlQa0zsQpsUyQPZhXt0SD0/DP8FV8GbJFHt90jH4TZauJvsiC
 rX0P50tVOFySBYOCdouVpoc/MVDUCK6Shey/Q0GodaSeH7tw/w+isaR2ftvr/bH3
 c9PQ27b5/s1VM+FIHQxY4J9xiW49GhPZaG4eIB506XDU13q0aZ4bfg6PR1YId5sR
 MdX4gtkkvvZG2Ufa1QCYePY7P6sA+Zxjrg/TBXntgAv759bYds1pLv0SNehLP1F+
 3pKwrN9tuuy/yAIRA783Pp6/0oVaEajEeAA+7xNx0U3qC6E1MAY=
 =i27Z
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2024-03-02 09:25:12 -08:00
commit 705c72567b
2 changed files with 8 additions and 8 deletions

View File

@ -127,8 +127,6 @@ static int gen_74x164_probe(struct spi_device *spi)
if (IS_ERR(chip->gpiod_oe))
return PTR_ERR(chip->gpiod_oe);
gpiod_set_value_cansleep(chip->gpiod_oe, 1);
spi_set_drvdata(spi, chip);
chip->gpio_chip.label = spi->modalias;
@ -153,6 +151,8 @@ static int gen_74x164_probe(struct spi_device *spi)
goto exit_destroy;
}
gpiod_set_value_cansleep(chip->gpiod_oe, 1);
ret = gpiochip_add_data(&chip->gpio_chip, chip);
if (!ret)
return 0;

View File

@ -968,11 +968,11 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,
ret = gpiochip_irqchip_init_valid_mask(gc);
if (ret)
goto err_remove_acpi_chip;
goto err_free_hogs;
ret = gpiochip_irqchip_init_hw(gc);
if (ret)
goto err_remove_acpi_chip;
goto err_remove_irqchip_mask;
ret = gpiochip_add_irqchip(gc, lock_key, request_key);
if (ret)
@ -997,13 +997,13 @@ err_remove_irqchip:
gpiochip_irqchip_remove(gc);
err_remove_irqchip_mask:
gpiochip_irqchip_free_valid_mask(gc);
err_remove_acpi_chip:
acpi_gpiochip_remove(gc);
err_remove_of_chip:
err_free_hogs:
gpiochip_free_hogs(gc);
acpi_gpiochip_remove(gc);
gpiochip_remove_pin_ranges(gc);
err_remove_of_chip:
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);