[PATCH 04/10] KVM: ARM: VGIC: Optimize the vGIC kvm_vgic_init function.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add a out_unlock flag, for the different unusual can goto the
corresponding flag.

Signed-off-by: wanghaibin <wanghaibin.wang@xxxxxxxxxx>
---
 virt/kvm/arm/vgic.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c
index bd4b104..d6a6c05 100644
--- a/virt/kvm/arm/vgic.c
+++ b/virt/kvm/arm/vgic.c
@@ -1897,19 +1897,19 @@ int kvm_vgic_init(struct kvm *kvm)
 	mutex_lock(&kvm->lock);
 
 	if (vgic_initialized(kvm))
-		goto out;
+		goto out_unlock;
 
 	if (IS_VGIC_ADDR_UNDEF(kvm->arch.vgic.vgic_dist_base) ||
 	    IS_VGIC_ADDR_UNDEF(kvm->arch.vgic.vgic_cpu_base)) {
 		kvm_err("Need to set vgic cpu and dist addresses first\n");
 		ret = -ENXIO;
-		goto out;
+		goto out_unlock;
 	}
 
 	ret = vgic_init_maps(kvm);
 	if (ret) {
 		kvm_err("Unable to allocate maps\n");
-		goto out;
+		goto out_unlock;
 	}
 
 	ret = kvm_phys_addr_ioremap(kvm, kvm->arch.vgic.vgic_cpu_base,
@@ -1927,6 +1927,8 @@ int kvm_vgic_init(struct kvm *kvm)
 out:
 	if (ret)
 		kvm_vgic_destroy(kvm);
+
+out_unlock:
 	mutex_unlock(&kvm->lock);
 	return ret;
 }
-- 
1.7.1


_______________________________________________
kvmarm mailing list
kvmarm@xxxxxxxxxxxxxxxxxxxxx
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm




[Index of Archives]     [Linux KVM]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux