aboutsummaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
authorWei Yongjun <yjwei@cn.fujitsu.com>2010-03-11 23:59:06 -0500
committerAvi Kivity <avi@redhat.com>2010-05-17 05:15:34 -0400
commita87fa35514bcf17aeca97245574e3f735cec9074 (patch)
tree484645e461ed2b75cb3b08092723883d60b14d23 /virt
parent600f1ec3761671307935a583c46f17fff0fa9b72 (diff)
KVM: fix the errno of ioctl KVM_[UN]REGISTER_COALESCED_MMIO failure
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>
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/coalesced_mmio.c4
-rw-r--r--virt/kvm/kvm_main.c2
2 files changed, 2 insertions, 4 deletions
diff --git a/virt/kvm/coalesced_mmio.c b/virt/kvm/coalesced_mmio.c
index 36e258029649..b66001f8754c 100644
--- a/virt/kvm/coalesced_mmio.c
+++ b/virt/kvm/coalesced_mmio.c
@@ -139,7 +139,7 @@ int kvm_vm_ioctl_register_coalesced_mmio(struct kvm *kvm,
139 struct kvm_coalesced_mmio_dev *dev = kvm->coalesced_mmio_dev; 139 struct kvm_coalesced_mmio_dev *dev = kvm->coalesced_mmio_dev;
140 140
141 if (dev == NULL) 141 if (dev == NULL)
142 return -EINVAL; 142 return -ENXIO;
143 143
144 mutex_lock(&kvm->slots_lock); 144 mutex_lock(&kvm->slots_lock);
145 if (dev->nb_zones >= KVM_COALESCED_MMIO_ZONE_MAX) { 145 if (dev->nb_zones >= KVM_COALESCED_MMIO_ZONE_MAX) {
@@ -162,7 +162,7 @@ int kvm_vm_ioctl_unregister_coalesced_mmio(struct kvm *kvm,
162 struct kvm_coalesced_mmio_zone *z; 162 struct kvm_coalesced_mmio_zone *z;
163 163
164 if (dev == NULL) 164 if (dev == NULL)
165 return -EINVAL; 165 return -ENXIO;
166 166
167 mutex_lock(&kvm->slots_lock); 167 mutex_lock(&kvm->slots_lock);
168 168
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index b152b23cd095..0db6dfcc8420 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1609,7 +1609,6 @@ static long kvm_vm_ioctl(struct file *filp,
1609 r = -EFAULT; 1609 r = -EFAULT;
1610 if (copy_from_user(&zone, argp, sizeof zone)) 1610 if (copy_from_user(&zone, argp, sizeof zone))
1611 goto out; 1611 goto out;
1612 r = -ENXIO;
1613 r = kvm_vm_ioctl_register_coalesced_mmio(kvm, &zone); 1612 r = kvm_vm_ioctl_register_coalesced_mmio(kvm, &zone);
1614 if (r) 1613 if (r)
1615 goto out; 1614 goto out;
@@ -1621,7 +1620,6 @@ static long kvm_vm_ioctl(struct file *filp,
1621 r = -EFAULT; 1620 r = -EFAULT;
1622 if (copy_from_user(&zone, argp, sizeof zone)) 1621 if (copy_from_user(&zone, argp, sizeof zone))
1623 goto out; 1622 goto out;
1624 r = -ENXIO;
1625 r = kvm_vm_ioctl_unregister_coalesced_mmio(kvm, &zone); 1623 r = kvm_vm_ioctl_unregister_coalesced_mmio(kvm, &zone);
1626 if (r) 1624 if (r)
1627 goto out; 1625 goto out;