Commit a87fa355 authored by Wei Yongjun's avatar Wei Yongjun Committed by Avi Kivity

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: default avatarWei Yongjun <yjwei@cn.fujitsu.com>
Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
parent 600f1ec3
...@@ -139,7 +139,7 @@ int kvm_vm_ioctl_register_coalesced_mmio(struct kvm *kvm, ...@@ -139,7 +139,7 @@ int kvm_vm_ioctl_register_coalesced_mmio(struct kvm *kvm,
struct kvm_coalesced_mmio_dev *dev = kvm->coalesced_mmio_dev; struct kvm_coalesced_mmio_dev *dev = kvm->coalesced_mmio_dev;
if (dev == NULL) if (dev == NULL)
return -EINVAL; return -ENXIO;
mutex_lock(&kvm->slots_lock); mutex_lock(&kvm->slots_lock);
if (dev->nb_zones >= KVM_COALESCED_MMIO_ZONE_MAX) { if (dev->nb_zones >= KVM_COALESCED_MMIO_ZONE_MAX) {
...@@ -162,7 +162,7 @@ int kvm_vm_ioctl_unregister_coalesced_mmio(struct kvm *kvm, ...@@ -162,7 +162,7 @@ int kvm_vm_ioctl_unregister_coalesced_mmio(struct kvm *kvm,
struct kvm_coalesced_mmio_zone *z; struct kvm_coalesced_mmio_zone *z;
if (dev == NULL) if (dev == NULL)
return -EINVAL; return -ENXIO;
mutex_lock(&kvm->slots_lock); mutex_lock(&kvm->slots_lock);
......
...@@ -1609,7 +1609,6 @@ static long kvm_vm_ioctl(struct file *filp, ...@@ -1609,7 +1609,6 @@ static long kvm_vm_ioctl(struct file *filp,
r = -EFAULT; r = -EFAULT;
if (copy_from_user(&zone, argp, sizeof zone)) if (copy_from_user(&zone, argp, sizeof zone))
goto out; goto out;
r = -ENXIO;
r = kvm_vm_ioctl_register_coalesced_mmio(kvm, &zone); r = kvm_vm_ioctl_register_coalesced_mmio(kvm, &zone);
if (r) if (r)
goto out; goto out;
...@@ -1621,7 +1620,6 @@ static long kvm_vm_ioctl(struct file *filp, ...@@ -1621,7 +1620,6 @@ static long kvm_vm_ioctl(struct file *filp,
r = -EFAULT; r = -EFAULT;
if (copy_from_user(&zone, argp, sizeof zone)) if (copy_from_user(&zone, argp, sizeof zone))
goto out; goto out;
r = -ENXIO;
r = kvm_vm_ioctl_unregister_coalesced_mmio(kvm, &zone); r = kvm_vm_ioctl_unregister_coalesced_mmio(kvm, &zone);
if (r) if (r)
goto out; goto out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment