diff options
-rw-r--r-- | virt/kvm/coalesced_mmio.c | 2 | ||||
-rw-r--r-- | virt/kvm/kvm_main.c | 12 |
2 files changed, 10 insertions, 4 deletions
diff --git a/virt/kvm/coalesced_mmio.c b/virt/kvm/coalesced_mmio.c index b66001f8754c..53850177163f 100644 --- a/virt/kvm/coalesced_mmio.c +++ b/virt/kvm/coalesced_mmio.c | |||
@@ -120,8 +120,10 @@ int kvm_coalesced_mmio_init(struct kvm *kvm) | |||
120 | return ret; | 120 | return ret; |
121 | 121 | ||
122 | out_free_dev: | 122 | out_free_dev: |
123 | kvm->coalesced_mmio_dev = NULL; | ||
123 | kfree(dev); | 124 | kfree(dev); |
124 | out_free_page: | 125 | out_free_page: |
126 | kvm->coalesced_mmio_ring = NULL; | ||
125 | __free_page(page); | 127 | __free_page(page); |
126 | out_err: | 128 | out_err: |
127 | return ret; | 129 | return ret; |
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 0db6dfcc8420..55a5d4804499 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -422,9 +422,6 @@ static struct kvm *kvm_create_vm(void) | |||
422 | spin_lock(&kvm_lock); | 422 | spin_lock(&kvm_lock); |
423 | list_add(&kvm->vm_list, &vm_list); | 423 | list_add(&kvm->vm_list, &vm_list); |
424 | spin_unlock(&kvm_lock); | 424 | spin_unlock(&kvm_lock); |
425 | #ifdef KVM_COALESCED_MMIO_PAGE_OFFSET | ||
426 | kvm_coalesced_mmio_init(kvm); | ||
427 | #endif | ||
428 | out: | 425 | out: |
429 | return kvm; | 426 | return kvm; |
430 | 427 | ||
@@ -1753,12 +1750,19 @@ static struct file_operations kvm_vm_fops = { | |||
1753 | 1750 | ||
1754 | static int kvm_dev_ioctl_create_vm(void) | 1751 | static int kvm_dev_ioctl_create_vm(void) |
1755 | { | 1752 | { |
1756 | int fd; | 1753 | int fd, r; |
1757 | struct kvm *kvm; | 1754 | struct kvm *kvm; |
1758 | 1755 | ||
1759 | kvm = kvm_create_vm(); | 1756 | kvm = kvm_create_vm(); |
1760 | if (IS_ERR(kvm)) | 1757 | if (IS_ERR(kvm)) |
1761 | return PTR_ERR(kvm); | 1758 | return PTR_ERR(kvm); |
1759 | #ifdef KVM_COALESCED_MMIO_PAGE_OFFSET | ||
1760 | r = kvm_coalesced_mmio_init(kvm); | ||
1761 | if (r < 0) { | ||
1762 | kvm_put_kvm(kvm); | ||
1763 | return r; | ||
1764 | } | ||
1765 | #endif | ||
1762 | fd = anon_inode_getfd("kvm-vm", &kvm_vm_fops, kvm, O_RDWR); | 1766 | fd = anon_inode_getfd("kvm-vm", &kvm_vm_fops, kvm, O_RDWR); |
1763 | if (fd < 0) | 1767 | if (fd < 0) |
1764 | kvm_put_kvm(kvm); | 1768 | kvm_put_kvm(kvm); |