diff options
-rw-r--r-- | chip/lm4/gpio.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/chip/lm4/gpio.c b/chip/lm4/gpio.c index a6aeeaa58f..604cd91234 100644 --- a/chip/lm4/gpio.c +++ b/chip/lm4/gpio.c @@ -290,9 +290,11 @@ static void gpio_interrupt(int port, uint32_t mis) int i = 0; const struct gpio_info *g = gpio_list; - for (i = 0; i < GPIO_COUNT; i++, g++) { - if (port == g->port && (mis & g->mask) && g->irq_handler) + for (i = 0; i < GPIO_COUNT && mis; i++, g++) { + if (port == g->port && (mis & g->mask) && g->irq_handler) { g->irq_handler(i); + mis &= ~g->mask; + } } } |