Commit 43ae312c authored by David Hildenbrand's avatar David Hildenbrand Committed by Radim Krčmář

KVM: x86: drop goto label in kvm_set_routing_entry()

No need for the goto label + local variable "r".
Reviewed-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 993225ad
...@@ -278,18 +278,16 @@ int kvm_set_routing_entry(struct kvm *kvm, ...@@ -278,18 +278,16 @@ int kvm_set_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;
/* also allow creation of routes during KVM_IRQCHIP_INIT_IN_PROGRESS */ /* also allow creation of routes during KVM_IRQCHIP_INIT_IN_PROGRESS */
if (kvm->arch.irqchip_mode == KVM_IRQCHIP_NONE) if (kvm->arch.irqchip_mode == KVM_IRQCHIP_NONE)
goto out; return -EINVAL;
/* Matches smp_wmb() when setting irqchip_mode */ /* Matches smp_wmb() when setting irqchip_mode */
smp_rmb(); smp_rmb();
switch (ue->type) { switch (ue->type) {
case KVM_IRQ_ROUTING_IRQCHIP: case KVM_IRQ_ROUTING_IRQCHIP:
if (irqchip_split(kvm)) if (irqchip_split(kvm))
goto out; return -EINVAL;
e->irqchip.pin = ue->u.irqchip.pin; e->irqchip.pin = ue->u.irqchip.pin;
switch (ue->u.irqchip.irqchip) { switch (ue->u.irqchip.irqchip) {
case KVM_IRQCHIP_PIC_SLAVE: case KVM_IRQCHIP_PIC_SLAVE:
...@@ -297,16 +295,16 @@ int kvm_set_routing_entry(struct kvm *kvm, ...@@ -297,16 +295,16 @@ int kvm_set_routing_entry(struct kvm *kvm,
/* fall through */ /* fall through */
case KVM_IRQCHIP_PIC_MASTER: case KVM_IRQCHIP_PIC_MASTER:
if (ue->u.irqchip.pin >= PIC_NUM_PINS / 2) if (ue->u.irqchip.pin >= PIC_NUM_PINS / 2)
goto out; return -EINVAL;
e->set = kvm_set_pic_irq; e->set = kvm_set_pic_irq;
break; break;
case KVM_IRQCHIP_IOAPIC: case KVM_IRQCHIP_IOAPIC:
if (ue->u.irqchip.pin >= KVM_IOAPIC_NUM_PINS) if (ue->u.irqchip.pin >= KVM_IOAPIC_NUM_PINS)
goto out; return -EINVAL;
e->set = kvm_set_ioapic_irq; e->set = kvm_set_ioapic_irq;
break; break;
default: default:
goto out; return -EINVAL;
} }
e->irqchip.irqchip = ue->u.irqchip.irqchip; e->irqchip.irqchip = ue->u.irqchip.irqchip;
break; break;
...@@ -317,7 +315,7 @@ int kvm_set_routing_entry(struct kvm *kvm, ...@@ -317,7 +315,7 @@ int kvm_set_routing_entry(struct kvm *kvm,
e->msi.data = ue->u.msi.data; e->msi.data = ue->u.msi.data;
if (kvm_msi_route_invalid(kvm, e)) if (kvm_msi_route_invalid(kvm, e))
goto out; return -EINVAL;
break; break;
case KVM_IRQ_ROUTING_HV_SINT: case KVM_IRQ_ROUTING_HV_SINT:
e->set = kvm_hv_set_sint; e->set = kvm_hv_set_sint;
...@@ -325,12 +323,10 @@ int kvm_set_routing_entry(struct kvm *kvm, ...@@ -325,12 +323,10 @@ int kvm_set_routing_entry(struct kvm *kvm,
e->hv_sint.sint = ue->u.hv_sint.sint; e->hv_sint.sint = ue->u.hv_sint.sint;
break; break;
default: default:
goto out; return -EINVAL;
} }
r = 0; return 0;
out:
return r;
} }
bool kvm_intr_is_single_vcpu(struct kvm *kvm, struct kvm_lapic_irq *irq, bool kvm_intr_is_single_vcpu(struct kvm *kvm, struct kvm_lapic_irq *irq,
......
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