From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Hildenbrand Subject: [PATCH v3 18/24] KVM: x86: cleanup return handling in setup_routing_entry() Date: Fri, 7 Apr 2017 10:50:35 +0200 Message-ID: <20170407085041.5257-19-david@redhat.com> References: <20170407085041.5257-1-david@redhat.com> Cc: Paolo Bonzini , rkrcmar@redhat.com, Peter Xu , david@redhat.com To: kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:55938 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756161AbdDGIvr (ORCPT ); Fri, 7 Apr 2017 04:51:47 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 371CE804E5 for ; Fri, 7 Apr 2017 08:51:47 +0000 (UTC) In-Reply-To: <20170407085041.5257-1-david@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Let's drop the goto and return the error value directly. Suggested-by: Peter Xu Signed-off-by: David Hildenbrand --- virt/kvm/irqchip.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/virt/kvm/irqchip.c b/virt/kvm/irqchip.c index 3bcc999..cc30d01 100644 --- a/virt/kvm/irqchip.c +++ b/virt/kvm/irqchip.c @@ -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) -- 2.9.3