diff mbox series

[v3,3/3] x86/APIC: adjustments to error_interrupt() loop

Message ID 880212ac370425389688f8b4fef2fd27c4fba446.1689191941.git.ehem+xen@m5p.com (mailing list archive)
State New, archived
Headers show
Series Fixing ACPI error reporting display | expand

Commit Message

Elliott Mitchell March 17, 2023, 7:53 p.m. UTC
ARRAY_SIZE() makes future maintainance easier and thus less likely for
bugs to occur.

Signed-off-by: Elliott Mitchell <ehem+xen@m5p.com>
---
v2:
        Breaking this miniscule tidbit off.
---
 xen/arch/x86/apic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jan Beulich July 13, 2023, 1:14 p.m. UTC | #1
On 17.03.2023 20:53, Elliott Mitchell wrote:
> 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>
diff mbox series

Patch

diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index 5b830b2312..18ceb35e34 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -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",