diff mbox series

[PULL,19/60] hw/i386/x86: Reverse if statement

Message ID f22f3a92eb728497dcd0f43e31b9148992db99bd.1707909001.git.mst@redhat.com (mailing list archive)
State New, archived
Headers show
Series [PULL,01/60] virtio: split into vhost-user-base and vhost-user-device | expand

Commit Message

Michael S. Tsirkin Feb. 14, 2024, 11:14 a.m. UTC
From: Bernhard Beschow <shentey@gmail.com>

The if statement currently uses double negation when executing the else branch.
So swap the branches and simplify the condition to make the code more
comprehensible.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Message-Id: <20240106132546.21248-2-shentey@gmail.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/i386/x86.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/hw/i386/x86.c b/hw/i386/x86.c
index 3d1bdd334e..505f64f89c 100644
--- a/hw/i386/x86.c
+++ b/hw/i386/x86.c
@@ -520,10 +520,10 @@  static void x86_nmi(NMIState *n, int cpu_index, Error **errp)
     CPU_FOREACH(cs) {
         X86CPU *cpu = X86_CPU(cs);
 
-        if (!cpu->apic_state) {
-            cpu_interrupt(cs, CPU_INTERRUPT_NMI);
-        } else {
+        if (cpu->apic_state) {
             apic_deliver_nmi(cpu->apic_state);
+        } else {
+            cpu_interrupt(cs, CPU_INTERRUPT_NMI);
         }
     }
 }