gpiolib: devres: release GPIOs in devm_gpiod_put_array()
PATCH 1/1 gpiolib: devres: release GPIOs in devm_gpiod_put_array()
devm_gpiod_put_array() is meant to undo the effects of devm_gpiod_get_array() - in particular, it should release the GPIOs contained in the array acquired with the latter. It is meant to be the resource-managed version of gpiod_put_array(), and it should behave similar to the non-array version devm_gpiod_put().
Since commit d1d52c6622a6 ("gpiolib: devres: Finish the conversion to use devm_add_action()") it doesn't do that anymore, it just removes the devres action and frees associated memory, but it doesn't actually release the GPIOs.
Fix by switching from devm_remove_action() to devm_release_action(), which will in addition invoke the action to release the GPIOs.
--- drivers/gpio/gpiolib-devres.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpiolib-devres.c +1 -1
@@ -319,7 +319,7 @@ EXPORT_SYMBOL_GPL(devm_gpiod_unhinge);*/ void devm_gpiod_put_array (struct device *dev,struct gpio_descs *descs) { -devm_remove_action (dev, devm_gpiod_release_array, descs); +devm_release_action (dev, devm_gpiod_release_array, descs); }EXPORT_SYMBOL_GPL (devm_gpiod_put_array);
---
base-commit: 58ba80c4740212c29a1cf9b48f588e60a7612209
change-id: 20250715-gpiolib-devres-put-array-fix-d6b365dad018
Best regards,
Signature · 1 line
André Draszik <[email protected]>
Quoted 11 lines · André Draszik
devm_gpiod_put_array()is meant to undo the effects ofdevm_gpiod_get_array()- in particular, it should release the GPIOs contained in the array acquired with the latter. It is meant to be the resource-managed version ofgpiod_put_array(), and it should behave similar to the non-array versiondevm_gpiod_put().Since commit
d1d52c6622a6("gpiolib: devres: Finish the conversion to usedevm_add_action()") it doesn't do that anymore, it just removes the devres action and frees associated memory, but it doesn't actually release the GPIOs.
Quoted 4 lines
Fix by switching from
devm_remove_action()todevm_release_action(), which will in addition invoke the action to release the GPIOs.Fixes d1d52c6622a6 ("gpiolib: devres: Finish the conversion to use devm_add_action()")
The culprit only exists in 6.16-rc for now, and it shouldn't be backported to older kernels, hence I didn't add CC: stable, hoping the patch can make it into the 6.16 release
Please let me know if that is unlikely and I shall send a v2 with
Cc: stable instead.
Cheers,
Andre'
From: Bartosz Golaszewski <[email protected]>
Quoted 6 lines · André Draszik
devm_gpiod_put_array()is meant to undo the effects ofdevm_gpiod_get_array()- in particular, it should release the GPIOs contained in the array acquired with the latter. It is meant to be the resource-managed version ofgpiod_put_array(), and it should behave similar to the non-array versiondevm_gpiod_put().
Quoted 6 lines
Since commit
d1d52c6622a6("gpiolib: devres: Finish the conversion to usedevm_add_action()") it doesn't do that anymore, it just removes the devres action and frees associated memory, but it doesn't actually release the GPIOs.[...]
Thanks for catching it, I queued it for v6.16-rc7.
[1/1] gpiolib: devres: release GPIOs in devm_gpiod_put_array()
https://git.kernel.org/brgl/linux/c/ff20798820e08af0fe757c756914b4aa51993ccb
Best regards,
Signature · 1 line
Bartosz Golaszewski <[email protected]>
Quoted 11 lines · Bartosz Golaszewski
Quoted 10 lines · André Draszik
devm_gpiod_put_array()is meant to undo the effects ofdevm_gpiod_get_array()- in particular, it should release the GPIOs contained in the array acquired with the latter. It is meant to be the resource-managed version ofgpiod_put_array(), and it should behave similar to the non-array versiondevm_gpiod_put().Since commit
d1d52c6622a6("gpiolib: devres: Finish the conversion to usedevm_add_action()") it doesn't do that anymore, it just removes the devres action and frees associated memory, but it doesn't actually release the GPIOs.
[...]
Quoted 1 line
Thanks for catching it, I queued it for v6.16-rc7.
Yeah, I used the release function in parameter, but not changed the call. Thanks for a good catch!
Signature · 2 lines
With Best Regards, Andy Shevchenko