Skip to contentSkip to conversation

KVM: Adding 'else' to reduce checking.

PATCH linmiaohe 1 participant 1 message Jan 16, 2020 KVM

lore
Share & tools
lore

linmiaohe

author Reviewed-by
#0 lore raw

Hi:

Quoted 24 lines · Haiwei Li

From 4e19436679a97e3cee73b4ae613ff91580c721d2 Mon Sep 17 00:00:00 2001
From: Haiwei Li <[email protected]>
Date: Thu, 16 Jan 2020 13:51:03 +0800
Subject: [PATCH] Adding 'else' to reduce checking.

These two conditions are in conflict, adding 'else' to reduce checking.

---
  arch/x86/kvm/lapic.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/lapic.c +1 -1
@@ -1573,7 +1573,7 @@ static void
 kvm_apic_inject_pending_timer_irqs(struct kvm_lapic *apic)
         kvm_apic_local_deliver(apic, APIC_LVTT);
         if (apic_lvtt_tscdeadline(apic))
                 ktimer->tscdeadline = 0;
-       if (apic_lvtt_oneshot(apic)) {
+       else if (apic_lvtt_oneshot(apic)) {
                 ktimer->tscdeadline = 0;
                 ktimer->target_expiration = 0;
Quoted 1 line
         }

Except for the coding style figured out by Vitaly, this patch looks fine for me. So: