]> git.karo-electronics.de Git - linux-beck.git/commitdiff
KVM: fix the errno of ioctl KVM_[UN]REGISTER_COALESCED_MMIO failure
authorWei Yongjun <yjwei@cn.fujitsu.com>
Fri, 12 Mar 2010 04:59:06 +0000 (12:59 +0800)
committerAvi Kivity <avi@redhat.com>
Mon, 17 May 2010 09:15:34 +0000 (12:15 +0300)
This patch change the errno of ioctl KVM_[UN]REGISTER_COALESCED_MMIO
from -EINVAL to -ENXIO if no coalesced mmio dev exists.

Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
virt/kvm/coalesced_mmio.c
virt/kvm/kvm_main.c

index 36e258029649c719fec91a1feb7306604ae90ab9..b66001f8754c80cc037ba51034fd0d5d0b4b7d68 100644 (file)
@@ -139,7 +139,7 @@ int kvm_vm_ioctl_register_coalesced_mmio(struct kvm *kvm,
        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) {
@@ -162,7 +162,7 @@ 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);
 
index b152b23cd09564d2f056fc5a1237a25e1428d2c0..0db6dfcc84202f8b510a793bfe865aaca38be72c 100644 (file)
@@ -1609,7 +1609,6 @@ static long kvm_vm_ioctl(struct file *filp,
                r = -EFAULT;
                if (copy_from_user(&zone, argp, sizeof zone))
                        goto out;
-               r = -ENXIO;
                r = kvm_vm_ioctl_register_coalesced_mmio(kvm, &zone);
                if (r)
                        goto out;
@@ -1621,7 +1620,6 @@ static long kvm_vm_ioctl(struct file *filp,
                r = -EFAULT;
                if (copy_from_user(&zone, argp, sizeof zone))
                        goto out;
-               r = -ENXIO;
                r = kvm_vm_ioctl_unregister_coalesced_mmio(kvm, &zone);
                if (r)
                        goto out;