]> xenbits.xensource.com Git - people/aperard/xen-unstable.git/commitdiff
x86/APIC: adjustments to error_interrupt() loop
authorElliott Mitchell <ehem+xen@m5p.com>
Thu, 13 Jul 2023 14:59:18 +0000 (16:59 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 13 Jul 2023 14:59:18 +0000 (16:59 +0200)
ARRAY_SIZE() makes future maintainance easier and thus less likely for
bugs to occur.

Signed-off-by: Elliott Mitchell <ehem+xen@m5p.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/apic.c

index 08459228e0d6a15c6120d53b26350d3e947d1bfb..ce556b2684647c406dfa67b1166cb2e834f374e7 100644 (file)
@@ -1412,7 +1412,7 @@ static void cf_check error_interrupt(struct cpu_user_regs *regs)
     };
     const char *entries[ARRAY_SIZE(esr_fields)];
     unsigned int v, v1;
-    int i;
+    unsigned int i;
 
     /* First tickle the hardware, only then report what went on. -- REW */
     v = apic_read(APIC_ESR);
@@ -1420,7 +1420,7 @@ static void cf_check error_interrupt(struct cpu_user_regs *regs)
     v1 = apic_read(APIC_ESR);
     ack_APIC_irq();
 
-    for ( i = 7; i >= 0; --i )
+    for ( i = 0; i < ARRAY_SIZE(entries); ++i )
         entries[i] = v1 & (1 << i) ? esr_fields[i] : "";
     printk(XENLOG_DEBUG
            "APIC error on CPU%u: %02x(%02x)%s%s%s%s%s%s%s%s\n",