Commit 8c6b7828 authored by David Hildenbrand's avatar David Hildenbrand Committed by Radim Krčmář

KVM: x86: cleanup return handling in setup_routing_entry()

Let's drop the goto and return the error value directly.
Suggested-by: default avatarPeter Xu <peterx@redhat.com>
Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
Signed-off-by: default avatarRadim Krčmář <rkrcmar@redhat.com>
parent 43ae312c
...@@ -142,8 +142,8 @@ static int setup_routing_entry(struct kvm *kvm, ...@@ -142,8 +142,8 @@ static int setup_routing_entry(struct kvm *kvm,
struct kvm_kernel_irq_routing_entry *e, struct kvm_kernel_irq_routing_entry *e,
const struct kvm_irq_routing_entry *ue) const struct kvm_irq_routing_entry *ue)
{ {
int r = -EINVAL;
struct kvm_kernel_irq_routing_entry *ei; struct kvm_kernel_irq_routing_entry *ei;
int r;
/* /*
* Do not allow GSI to be mapped to the same irqchip more than once. * 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, ...@@ -153,20 +153,19 @@ static int setup_routing_entry(struct kvm *kvm,
if (ei->type != KVM_IRQ_ROUTING_IRQCHIP || if (ei->type != KVM_IRQ_ROUTING_IRQCHIP ||
ue->type != KVM_IRQ_ROUTING_IRQCHIP || ue->type != KVM_IRQ_ROUTING_IRQCHIP ||
ue->u.irqchip.irqchip == ei->irqchip.irqchip) ue->u.irqchip.irqchip == ei->irqchip.irqchip)
return r; return -EINVAL;
e->gsi = ue->gsi; e->gsi = ue->gsi;
e->type = ue->type; e->type = ue->type;
r = kvm_set_routing_entry(kvm, e, ue); r = kvm_set_routing_entry(kvm, e, ue);
if (r) if (r)
goto out; return r;
if (e->type == KVM_IRQ_ROUTING_IRQCHIP) if (e->type == KVM_IRQ_ROUTING_IRQCHIP)
rt->chip[e->irqchip.irqchip][e->irqchip.pin] = e->gsi; rt->chip[e->irqchip.irqchip][e->irqchip.pin] = e->gsi;
hlist_add_head(&e->link, &rt->map[e->gsi]); hlist_add_head(&e->link, &rt->map[e->gsi]);
r = 0;
out: return 0;
return r;
} }
void __attribute__((weak)) kvm_arch_irq_routing_update(struct kvm *kvm) void __attribute__((weak)) kvm_arch_irq_routing_update(struct kvm *kvm)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment