KVM: s390: drop out early in kvm_s390_has_irq()
authorDavid Hildenbrand <dahi@linux.vnet.ibm.com>
Wed, 6 May 2015 11:51:29 +0000 (13:51 +0200)
committerChristian Borntraeger <borntraeger@de.ibm.com>
Tue, 13 Oct 2015 13:50:33 +0000 (15:50 +0200)
Let's get rid of the local variable and exit directly if we found
any pending interrupt. This is not only faster, but also better
readable.

Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
arch/s390/kvm/interrupt.c

index 1260f8c18df986202b2e9e5e48c8164bcc4765ac..10a0e8beb9e1aab46baed9257c7a12181f417d4c 100644 (file)
@@ -808,23 +808,21 @@ int kvm_s390_ext_call_pending(struct kvm_vcpu *vcpu)
 
 int kvm_s390_vcpu_has_irq(struct kvm_vcpu *vcpu, int exclude_stop)
 {
-       int rc;
-
-       rc = !!deliverable_irqs(vcpu);
+       if (deliverable_irqs(vcpu))
+               return 1;
 
-       if (!rc && kvm_cpu_has_pending_timer(vcpu))
-               rc = 1;
+       if (kvm_cpu_has_pending_timer(vcpu))
+               return 1;
 
        /* external call pending and deliverable */
-       if (!rc && kvm_s390_ext_call_pending(vcpu) &&
+       if (kvm_s390_ext_call_pending(vcpu) &&
            !psw_extint_disabled(vcpu) &&
            (vcpu->arch.sie_block->gcr[0] & 0x2000ul))
-               rc = 1;
-
-       if (!rc && !exclude_stop && kvm_s390_is_stop_irq_pending(vcpu))
-               rc = 1;
+               return 1;
 
-       return rc;
+       if (!exclude_stop && kvm_s390_is_stop_irq_pending(vcpu))
+               return 1;
+       return 0;
 }
 
 int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu)
This page took 0.030581 seconds and 5 git commands to generate.