From: patrick Date: Thu, 23 Dec 2021 20:48:24 +0000 (+0000) Subject: Fix endless loop in the interrupt handler. When iterating over each X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=64dd1569190bb2fd8c2b3d94db44d00f29a0a2b2;p=openbsd Fix endless loop in the interrupt handler. When iterating over each GPIO base register we must not replace the iterator variable with the index of the pin inside the register. ok kettenis@ --- diff --git a/sys/arch/arm64/dev/aplpinctrl.c b/sys/arch/arm64/dev/aplpinctrl.c index d1c2cf6b841..a090585fbf2 100644 --- a/sys/arch/arm64/dev/aplpinctrl.c +++ b/sys/arch/arm64/dev/aplpinctrl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aplpinctrl.c,v 1.2 2021/10/30 14:50:54 kettenis Exp $ */ +/* $OpenBSD: aplpinctrl.c,v 1.3 2021/12/23 20:48:24 patrick Exp $ */ /* * Copyright (c) 2021 Mark Kettenis * @@ -266,15 +266,15 @@ aplpinctrl_intr(void *arg) struct aplpinctrl_softc *sc = arg; struct intrhand *ih; uint32_t status, pending; - int pin, s; + int base, pin, s; - for (pin = 0; pin < sc->sc_ngpios; pin += 32) { - status = HREAD4(sc, GPIO_IRQ(0, pin)); + for (base = 0; base < sc->sc_ngpios; base += 32) { + status = HREAD4(sc, GPIO_IRQ(0, base)); pending = status; while (pending) { pin = ffs(pending) - 1; - ih = sc->sc_handler[pin]; + ih = sc->sc_handler[base + pin]; if (ih) { s = splraise(ih->ih_ipl); @@ -286,7 +286,7 @@ aplpinctrl_intr(void *arg) pending &= ~(1 << pin); } - HWRITE4(sc, GPIO_IRQ(0, pin), status); + HWRITE4(sc, GPIO_IRQ(0, base), status); } return 1;