Skip to content

Commit 705c725

Browse files
committed
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
2 parents 7838b46 + ec5c54a commit 705c725

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

drivers/gpio/gpio-74x164.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,6 @@ static int gen_74x164_probe(struct spi_device *spi)
127127
if (IS_ERR(chip->gpiod_oe))
128128
return PTR_ERR(chip->gpiod_oe);
129129

130-
gpiod_set_value_cansleep(chip->gpiod_oe, 1);
131-
132130
spi_set_drvdata(spi, chip);
133131

134132
chip->gpio_chip.label = spi->modalias;
@@ -153,6 +151,8 @@ static int gen_74x164_probe(struct spi_device *spi)
153151
goto exit_destroy;
154152
}
155153

154+
gpiod_set_value_cansleep(chip->gpiod_oe, 1);
155+
156156
ret = gpiochip_add_data(&chip->gpio_chip, chip);
157157
if (!ret)
158158
return 0;

drivers/gpio/gpiolib.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -968,11 +968,11 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,
968968

969969
ret = gpiochip_irqchip_init_valid_mask(gc);
970970
if (ret)
971-
goto err_remove_acpi_chip;
971+
goto err_free_hogs;
972972

973973
ret = gpiochip_irqchip_init_hw(gc);
974974
if (ret)
975-
goto err_remove_acpi_chip;
975+
goto err_remove_irqchip_mask;
976976

977977
ret = gpiochip_add_irqchip(gc, lock_key, request_key);
978978
if (ret)
@@ -997,13 +997,13 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,
997997
gpiochip_irqchip_remove(gc);
998998
err_remove_irqchip_mask:
999999
gpiochip_irqchip_free_valid_mask(gc);
1000-
err_remove_acpi_chip:
1000+
err_free_hogs:
1001+
gpiochip_free_hogs(gc);
10011002
acpi_gpiochip_remove(gc);
1003+
gpiochip_remove_pin_ranges(gc);
10021004
err_remove_of_chip:
1003-
gpiochip_free_hogs(gc);
10041005
of_gpiochip_remove(gc);
10051006
err_free_gpiochip_mask:
1006-
gpiochip_remove_pin_ranges(gc);
10071007
gpiochip_free_valid_mask(gc);
10081008
err_remove_from_list:
10091009
spin_lock_irqsave(&gpio_lock, flags);

0 commit comments

Comments
 (0)