This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch releases/13.0 in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 3899064e414b7b9d1156e905ea618bfd545b2825 Author: Javier Alonso <[email protected]> AuthorDate: Fri Jul 24 12:25:40 2026 +0200 stm32: Detach GPIO IRQ callbacks upon clearing "setevent" 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 <[email protected]> --- arch/arm/src/common/stm32/stm32_exti_gpio_m0_v1.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/arm/src/common/stm32/stm32_exti_gpio_m0_v1.c b/arch/arm/src/common/stm32/stm32_exti_gpio_m0_v1.c index 00b9158085c..b143d31dc9e 100644 --- a/arch/arm/src/common/stm32/stm32_exti_gpio_m0_v1.c +++ b/arch/arm/src/common/stm32/stm32_exti_gpio_m0_v1.c @@ -221,6 +221,7 @@ int stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge, xcpt_t handler; int nshared; int i; + int ret; /* Select the interrupt handler for this EXTI pin */ @@ -274,6 +275,16 @@ int stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge, if (i == nshared) { + /* remove any leftover callback */ + + ret = irq_detach(irq); + if (ret < 0) + { + return ret; + } + + /* disable the interrupt */ + up_disable_irq(irq); } }
