umh: creds: convert call_usermodehelper_keys() to use subprocess_info->init()
[safe/jmp/linux-2.6] / virt / kvm / coalesced_mmio.c
index 5de6594..5385017 100644 (file)
@@ -10,6 +10,7 @@
 #include "iodev.h"
 
 #include <linux/kvm_host.h>
+#include <linux/slab.h>
 #include <linux/kvm.h>
 
 #include "coalesced_mmio.h"
@@ -119,8 +120,10 @@ int kvm_coalesced_mmio_init(struct kvm *kvm)
        return ret;
 
 out_free_dev:
+       kvm->coalesced_mmio_dev = NULL;
        kfree(dev);
 out_free_page:
+       kvm->coalesced_mmio_ring = NULL;
        __free_page(page);
 out_err:
        return ret;
@@ -133,12 +136,12 @@ void kvm_coalesced_mmio_free(struct kvm *kvm)
 }
 
 int kvm_vm_ioctl_register_coalesced_mmio(struct kvm *kvm,
-                                        struct kvm_coalesced_mmio_zone *zone)
+                                        struct kvm_coalesced_mmio_zone *zone)
 {
        struct kvm_coalesced_mmio_dev *dev = kvm->coalesced_mmio_dev;
 
        if (dev == NULL)
-               return -EINVAL;
+               return -ENXIO;
 
        mutex_lock(&kvm->slots_lock);
        if (dev->nb_zones >= KVM_COALESCED_MMIO_ZONE_MAX) {
@@ -161,12 +164,12 @@ int kvm_vm_ioctl_unregister_coalesced_mmio(struct kvm *kvm,
        struct kvm_coalesced_mmio_zone *z;
 
        if (dev == NULL)
-               return -EINVAL;
+               return -ENXIO;
 
        mutex_lock(&kvm->slots_lock);
 
        i = dev->nb_zones;
-       while(i) {
+       while (i) {
                z = &dev->zone[i - 1];
 
                /* unregister all zones