mirror of
https://github.com/apache/nuttx.git
synced 2026-08-01 20:28:58 +00:00
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 <javieralonso@geotab.com>
This commit is contained in:
parent
2099ceda33
commit
577bf5acc9
1 changed files with 11 additions and 0 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue