stm32: Detach GPIO IRQ callbacks upon clearing "setevent" - #19520
Open
Javinator9889 wants to merge 2 commits into
Open
stm32: Detach GPIO IRQ callbacks upon clearing "setevent"#19520Javinator9889 wants to merge 2 commits into
Javinator9889 wants to merge 2 commits into
Conversation
Javinator9889
requested review from
jerpelea,
raiden00pl and
xiaoxiang781216
as code owners
July 24, 2026 10:31
Javinator9889
force-pushed
the
bugfix/stm32_detach_callbacks_upon_gpio_clearing
branch
from
July 24, 2026 10:31
d6efcec to
be784d2
Compare
When the interrupts get disabled, the callback(s) are still attached. That structure is never cleared, causing several calls to attach/detach to eventually fail as the callback queue gets full. When the error occurs, the registration fails with error 12 (ENOMEM). By detaching the IRQ and clearing the callbacks, this error doesn't happen again Signed-off-by: Javier Alonso <javieralonso@geotab.com>
Javinator9889
force-pushed
the
bugfix/stm32_detach_callbacks_upon_gpio_clearing
branch
from
July 24, 2026 10:39
be784d2 to
577bf5a
Compare
|
xiaoxiang781216
previously approved these changes
Jul 24, 2026
raiden00pl
reviewed
Jul 24, 2026
Javinator9889
force-pushed
the
bugfix/stm32_detach_callbacks_upon_gpio_clearing
branch
2 times, most recently
from
July 29, 2026 08:51
33d7af4 to
6624967
Compare
xiaoxiang781216
approved these changes
Jul 29, 2026
xiaoxiang781216
previously approved these changes
Jul 29, 2026
Contributor
|
Hi @Javinator9889 please fix these issues reported in the CI test: https://github.com/apache/nuttx/actions/runs/30437203902/job/90559277045?pr=19520 |
Contributor
Author
Yes, I'm on it. I already fixed one issue but I'm still looking to address the new ones |
Javinator9889
force-pushed
the
bugfix/stm32_detach_callbacks_upon_gpio_clearing
branch
from
July 29, 2026 16:08
6624967 to
7cd0423
Compare
The fix was ported from the STM32G0 to all the STM32 platforms, as the code is mostly the same hence presents the same failure Signed-off-by: Javier Alonso <javieralonso@geotab.com>
Javinator9889
force-pushed
the
bugfix/stm32_detach_callbacks_upon_gpio_clearing
branch
from
July 29, 2026 17:54
7cd0423 to
b54cca3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When the interrupts get disabled, the callback(s) are still attached. That structure is never cleared, causing several calls to attach/detach to eventually fail as the callback queue gets full.
When the error occurs, the registration fails with error 12 (ENOMEM). By detaching the IRQ and clearing the callbacks, this error doesn't happen again
Impact
Calling
stm32_gpioseteventseveral times enabling and disabling the event ends up fulling the callback's queue, causing future calls to fail withENOMEMwithout recovering from the error.Testing
This has been tested thoroughly by attaching/detaching the events several times in a row. The behavior is now deterministic and one can add and remove GPIO events as much as wanted