KVM: x86: cleanup return handling in setup_routing_entry()
authorDavid Hildenbrand <david@redhat.com>
Fri, 7 Apr 2017 08:50:35 +0000 (10:50 +0200)
committerRadim Krčmář <rkrcmar@redhat.com>
Wed, 12 Apr 2017 18:17:14 +0000 (20:17 +0200)
Let's drop the goto and return the error value directly.

Suggested-by: Peter Xu <peterx@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
virt/kvm/irqchip.c

index 3bcc999..cc30d01 100644 (file)
@@ -142,8 +142,8 @@ static int setup_routing_entry(struct kvm *kvm,
                               struct kvm_kernel_irq_routing_entry *e,
                               const struct kvm_irq_routing_entry *ue)
 {
-       int r = -EINVAL;
        struct kvm_kernel_irq_routing_entry *ei;
+       int r;
 
        /*
         * Do not allow GSI to be mapped to the same irqchip more than once.
@@ -153,20 +153,19 @@ static int setup_routing_entry(struct kvm *kvm,
                if (ei->type != KVM_IRQ_ROUTING_IRQCHIP ||
                    ue->type != KVM_IRQ_ROUTING_IRQCHIP ||
                    ue->u.irqchip.irqchip == ei->irqchip.irqchip)
-                       return r;
+                       return -EINVAL;
 
        e->gsi = ue->gsi;
        e->type = ue->type;
        r = kvm_set_routing_entry(kvm, e, ue);
        if (r)
-               goto out;
+               return r;
        if (e->type == KVM_IRQ_ROUTING_IRQCHIP)
                rt->chip[e->irqchip.irqchip][e->irqchip.pin] = e->gsi;
 
        hlist_add_head(&e->link, &rt->map[e->gsi]);
-       r = 0;
-out:
-       return r;
+
+       return 0;
 }
 
 void __attribute__((weak)) kvm_arch_irq_routing_update(struct kvm *kvm)