Skip to contentSkip to conversation

KVM: Adding 'else' to reduce checking.

PATCH Applied Haiwei Li 2 participants 2 messages Jan 16, 2020 – Jan 21, 2020

Subsystems (3)
lore
Share & tools
lore

Haiwei Li

author
#0 lore raw

PATCH v2 1/1 KVM: Adding 'else' to reduce checking.

From 009bfba9b6f6b41018708323d9ca651ae2075900 Mon Sep 17 00:00:00 2001
From: Haiwei Li <[email protected]>
Date: Thu, 16 Jan 2020 16:50:21 +0800
Subject: [PATCH] Adding 'else' to reduce checking.

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

---
 arch/x86/kvm/lapic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kvm/lapic.c +2 -2
index 679692b..f1cfb94 100644
@@ -1571,9 +1571,9 @@ static void kvm_apic_inject_pending_timer_irqs(struct kvm_lapic *apic)
        struct kvm_timer *ktimer = &apic->lapic_timer;
 
        kvm_apic_local_deliver(apic, APIC_LVTT);
-       if (apic_lvtt_tscdeadline(apic))
+       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;
        }

--
1.8.3.1

maintainer Applied
#1 lore raw
Quoted 30 lines · Haiwei Li

From 009bfba9b6f6b41018708323d9ca651ae2075900 Mon Sep 17 00:00:00 2001
From: Haiwei Li <[email protected]>
Date: Thu, 16 Jan 2020 16:50:21 +0800
Subject: [PATCH] Adding 'else' to reduce checking.

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

---
 arch/x86/kvm/lapic.c | 4 ++--

 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kvm/lapic.c +2 -2
index 679692b..f1cfb94 100644
@@ -1571,9 +1571,9 @@ static void
 kvm_apic_inject_pending_timer_irqs(struct kvm_lapic *apic)
         struct kvm_timer *ktimer = &apic->lapic_timer;
 
         kvm_apic_local_deliver(apic, APIC_LVTT);
-       if (apic_lvtt_tscdeadline(apic))
+       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 4 lines

        }

Signature · 1 line
1.8.3.1

Queued, thanks.

Paolo