Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/evbarm/g42xxeb evbarm/g42xxeb: Fix off-by-one in pr...



details:   https://anonhg.NetBSD.org/src/rev/5f647fb07834
branches:  trunk
changeset: 377498:5f647fb07834
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Fri Jul 14 12:57:10 2023 +0000

description:
evbarm/g42xxeb: Fix off-by-one in previous.

The original find_first_bit(x) was 31 - __builtin_clz((uint32_t)x),
which is equivalent to fls32(x) - 1, not to fls32(x).

Note that fls32 is 1-based and returns 0 for x=0.

diffstat:

 sys/arch/evbarm/g42xxeb/obio.c |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (18 lines):

diff -r 28a2071bcca4 -r 5f647fb07834 sys/arch/evbarm/g42xxeb/obio.c
--- a/sys/arch/evbarm/g42xxeb/obio.c    Fri Jul 14 09:32:42 2023 +0000
+++ b/sys/arch/evbarm/g42xxeb/obio.c    Fri Jul 14 12:57:10 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: obio.c,v 1.15 2023/07/13 20:22:29 mrg Exp $ */
+/*     $NetBSD: obio.c,v 1.16 2023/07/14 12:57:10 riastradh Exp $ */
 
 /*
  * Copyright (c) 2002, 2003, 2005  Genetec corp.  All rights reserved.
@@ -156,7 +156,7 @@ obio_softint(void *arg)
        int psw;
 
        psw = disable_interrupts(I32_bit);
-       while ((irqno = fls32(sc->sc_intr_pending)) >= 0) {
+       while ((irqno = fls32(sc->sc_intr_pending) - 1) >= 0) {
                sc->sc_intr_pending &= ~(1U<<irqno);
 
                restore_interrupts(psw);



Home | Main Index | Thread Index | Old Index