diff options
author | David Hildenbrand <david@redhat.com> | 2017-04-07 04:50:35 -0400 |
---|---|---|
committer | Radim Krčmář <rkrcmar@redhat.com> | 2017-04-12 14:17:14 -0400 |
commit | 8c6b7828c24a69416bcb639d5760c6eaa351fdf9 (patch) | |
tree | d89642f127ad11ada98a3cf2a2206d7ef6f2af25 | |
parent | 43ae312ca18a0d6d1a363295fa6a2a14a12605e8 (diff) |
KVM: x86: cleanup return handling in setup_routing_entry()
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>
-rw-r--r-- | virt/kvm/irqchip.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/virt/kvm/irqchip.c b/virt/kvm/irqchip.c index 3bcc9990adf7..cc30d01a56be 100644 --- a/virt/kvm/irqchip.c +++ b/virt/kvm/irqchip.c | |||
@@ -142,8 +142,8 @@ static int setup_routing_entry(struct kvm *kvm, | |||
142 | struct kvm_kernel_irq_routing_entry *e, | 142 | struct kvm_kernel_irq_routing_entry *e, |
143 | const struct kvm_irq_routing_entry *ue) | 143 | const struct kvm_irq_routing_entry *ue) |
144 | { | 144 | { |
145 | int r = -EINVAL; | ||
146 | struct kvm_kernel_irq_routing_entry *ei; | 145 | struct kvm_kernel_irq_routing_entry *ei; |
146 | int r; | ||
147 | 147 | ||
148 | /* | 148 | /* |
149 | * Do not allow GSI to be mapped to the same irqchip more than once. | 149 | * 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 | if (ei->type != KVM_IRQ_ROUTING_IRQCHIP || | 153 | if (ei->type != KVM_IRQ_ROUTING_IRQCHIP || |
154 | ue->type != KVM_IRQ_ROUTING_IRQCHIP || | 154 | ue->type != KVM_IRQ_ROUTING_IRQCHIP || |
155 | ue->u.irqchip.irqchip == ei->irqchip.irqchip) | 155 | ue->u.irqchip.irqchip == ei->irqchip.irqchip) |
156 | return r; | 156 | return -EINVAL; |
157 | 157 | ||
158 | e->gsi = ue->gsi; | 158 | e->gsi = ue->gsi; |
159 | e->type = ue->type; | 159 | e->type = ue->type; |
160 | r = kvm_set_routing_entry(kvm, e, ue); | 160 | r = kvm_set_routing_entry(kvm, e, ue); |
161 | if (r) | 161 | if (r) |
162 | goto out; | 162 | return r; |
163 | if (e->type == KVM_IRQ_ROUTING_IRQCHIP) | 163 | if (e->type == KVM_IRQ_ROUTING_IRQCHIP) |
164 | rt->chip[e->irqchip.irqchip][e->irqchip.pin] = e->gsi; | 164 | rt->chip[e->irqchip.irqchip][e->irqchip.pin] = e->gsi; |
165 | 165 | ||
166 | hlist_add_head(&e->link, &rt->map[e->gsi]); | 166 | hlist_add_head(&e->link, &rt->map[e->gsi]); |
167 | r = 0; | 167 | |
168 | out: | 168 | return 0; |
169 | return r; | ||
170 | } | 169 | } |
171 | 170 | ||
172 | void __attribute__((weak)) kvm_arch_irq_routing_update(struct kvm *kvm) | 171 | void __attribute__((weak)) kvm_arch_irq_routing_update(struct kvm *kvm) |