Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1ae77bad authored by Wei Yongjun's avatar Wei Yongjun Committed by Marcelo Tosatti
Browse files

KVM: kvm->arch.vioapic should be NULL if kvm_ioapic_init() failure



kvm->arch.vioapic should be NULL in case of kvm_ioapic_init() failure
due to cannot register io dev.

Signed-off-by: default avatarWei Yongjun <yjwei@cn.fujitsu.com>
Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
parent d225f53b
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -393,8 +393,10 @@ int kvm_ioapic_init(struct kvm *kvm)
	mutex_lock(&kvm->slots_lock);
	ret = kvm_io_bus_register_dev(kvm, KVM_MMIO_BUS, &ioapic->dev);
	mutex_unlock(&kvm->slots_lock);
	if (ret < 0)
	if (ret < 0) {
		kvm->arch.vioapic = NULL;
		kfree(ioapic);
	}

	return ret;
}