diff options
author | Wei Yongjun <yjwei@cn.fujitsu.com> | 2010-02-08 21:31:09 -0500 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2010-03-01 10:36:09 -0500 |
commit | 1ae77badc2504d157800f10a81a58cc9c941e7cb (patch) | |
tree | 57f590b82a8e20863635ce8b528b79c022b0a8e9 /virt/kvm | |
parent | d225f53b76f4287365efd381b9e3a732e6bad27e (diff) |
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: Wei Yongjun <yjwei@cn.fujitsu.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'virt/kvm')
-rw-r--r-- | virt/kvm/ioapic.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c index a2edfd177faf..f3d06934ae6d 100644 --- a/virt/kvm/ioapic.c +++ b/virt/kvm/ioapic.c | |||
@@ -393,8 +393,10 @@ int kvm_ioapic_init(struct kvm *kvm) | |||
393 | mutex_lock(&kvm->slots_lock); | 393 | mutex_lock(&kvm->slots_lock); |
394 | ret = kvm_io_bus_register_dev(kvm, KVM_MMIO_BUS, &ioapic->dev); | 394 | ret = kvm_io_bus_register_dev(kvm, KVM_MMIO_BUS, &ioapic->dev); |
395 | mutex_unlock(&kvm->slots_lock); | 395 | mutex_unlock(&kvm->slots_lock); |
396 | if (ret < 0) | 396 | if (ret < 0) { |
397 | kvm->arch.vioapic = NULL; | ||
397 | kfree(ioapic); | 398 | kfree(ioapic); |
399 | } | ||
398 | 400 | ||
399 | return ret; | 401 | return ret; |
400 | } | 402 | } |