aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--virt/kvm/arm/vgic/vgic-mmio-v3.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/virt/kvm/arm/vgic/vgic-mmio-v3.c b/virt/kvm/arm/vgic/vgic-mmio-v3.c
index 9b0f6810e7a8..201d5e2e973d 100644
--- a/virt/kvm/arm/vgic/vgic-mmio-v3.c
+++ b/virt/kvm/arm/vgic/vgic-mmio-v3.c
@@ -614,15 +614,16 @@ int vgic_register_redist_iodev(struct kvm_vcpu *vcpu)
614 mutex_lock(&kvm->slots_lock); 614 mutex_lock(&kvm->slots_lock);
615 ret = kvm_io_bus_register_dev(kvm, KVM_MMIO_BUS, sgi_base, 615 ret = kvm_io_bus_register_dev(kvm, KVM_MMIO_BUS, sgi_base,
616 SZ_64K, &sgi_dev->dev); 616 SZ_64K, &sgi_dev->dev);
617 mutex_unlock(&kvm->slots_lock);
618 if (ret) { 617 if (ret) {
619 kvm_io_bus_unregister_dev(kvm, KVM_MMIO_BUS, 618 kvm_io_bus_unregister_dev(kvm, KVM_MMIO_BUS,
620 &rd_dev->dev); 619 &rd_dev->dev);
621 return ret; 620 goto out;
622 } 621 }
623 622
624 vgic->vgic_redist_free_offset += 2 * SZ_64K; 623 vgic->vgic_redist_free_offset += 2 * SZ_64K;
625 return 0; 624out:
625 mutex_unlock(&kvm->slots_lock);
626 return ret;
626} 627}
627 628
628static void vgic_unregister_redist_iodev(struct kvm_vcpu *vcpu) 629static void vgic_unregister_redist_iodev(struct kvm_vcpu *vcpu)
@@ -647,10 +648,12 @@ static int vgic_register_all_redist_iodevs(struct kvm *kvm)
647 648
648 if (ret) { 649 if (ret) {
649 /* The current c failed, so we start with the previous one. */ 650 /* The current c failed, so we start with the previous one. */
651 mutex_lock(&kvm->slots_lock);
650 for (c--; c >= 0; c--) { 652 for (c--; c >= 0; c--) {
651 vcpu = kvm_get_vcpu(kvm, c); 653 vcpu = kvm_get_vcpu(kvm, c);
652 vgic_unregister_redist_iodev(vcpu); 654 vgic_unregister_redist_iodev(vcpu);
653 } 655 }
656 mutex_unlock(&kvm->slots_lock);
654 } 657 }
655 658
656 return ret; 659 return ret;