kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicholas Krause <xerofoify@gmail.com>
To: christoffer.dall@linaro.org
Cc: kvm@vger.kernel.org, marc.zyngier@arm.com,
	linux-kernel@vger.kernel.org, gleb@kernel.org,
	pbonzini@redhat.com, kvmarm@lists.cs.columbia.edu,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH] kvm:arm:Fix error handling in the function vgic_v3_probe
Date: Wed,  5 Aug 2015 12:48:23 -0400	[thread overview]
Message-ID: <1438793303-30228-1-git-send-email-xerofoify@gmail.com> (raw)

This fixes the error handling in the function vgic_v3_probe
for when calling the function kvm_register_device_ops to check
if the call to this function has returned a error code and if
so jump to the label out with goto to cleanup no longer required
resources used by the function vgic_v3_probe before returning the
error code from the call to kvm_register_device_ops to the caller
of the function vgic_v3_probe.

Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
---
 virt/kvm/arm/vgic-v3.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/virt/kvm/arm/vgic-v3.c b/virt/kvm/arm/vgic-v3.c
index dff0602..5102aa2 100644
--- a/virt/kvm/arm/vgic-v3.c
+++ b/virt/kvm/arm/vgic-v3.c
@@ -264,12 +264,16 @@ int vgic_v3_probe(struct device_node *vgic_node,
 	} else {
 		vgic->vcpu_base = vcpu_res.start;
 		vgic->can_emulate_gicv2 = true;
-		kvm_register_device_ops(&kvm_arm_vgic_v2_ops,
-					KVM_DEV_TYPE_ARM_VGIC_V2);
+		ret = kvm_register_device_ops(&kvm_arm_vgic_v2_ops,
+					      KVM_DEV_TYPE_ARM_VGIC_V2);
+		if (ret)
+			goto out;
 	}
 	if (vgic->vcpu_base == 0)
 		kvm_info("disabling GICv2 emulation\n");
-	kvm_register_device_ops(&kvm_arm_vgic_v3_ops, KVM_DEV_TYPE_ARM_VGIC_V3);
+	ret = kvm_register_device_ops(&kvm_arm_vgic_v3_ops, KVM_DEV_TYPE_ARM_VGIC_V3);
+	if (ret)
+		goto out;
 
 	vgic->vctrl_base = NULL;
 	vgic->type = VGIC_V3;
-- 
2.1.4

             reply	other threads:[~2015-08-05 16:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-05 16:48 Nicholas Krause [this message]
2015-08-05 16:59 ` [PATCH] kvm:arm:Fix error handling in the function vgic_v3_probe Paolo Bonzini
2015-08-05 17:07   ` nick
2015-08-06  8:06     ` Marc Zyngier
2015-08-06 12:00       ` Paolo Bonzini
2015-08-06 12:08         ` Christoffer Dall
2015-08-06 13:16         ` nick
2015-08-07  0:47           ` Krzysztof Kozlowski
2015-08-07  1:31             ` nick
2015-08-07  1:36               ` Krzysztof Kozlowski
2015-08-07  1:40                 ` nick

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1438793303-30228-1-git-send-email-xerofoify@gmail.com \
    --to=xerofoify@gmail.com \
    --cc=christoffer.dall@linaro.org \
    --cc=gleb@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).