vhost: replace -1 with VHOST_FILE_UNBIND in ioctls
authorZhu Lingshan <lingshan.zhu@intel.com>
Fri, 5 Jun 2020 10:27:14 +0000 (18:27 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Sat, 6 Jun 2020 20:26:27 +0000 (16:26 -0400)
This commit replaces -1 with VHOST_FILE_UNBIND in ioctls since
we have added such a macro in the uapi header for vdpa_host.

Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Link: https://lore.kernel.org/r/1591352835-22441-5-git-send-email-lingshan.zhu@intel.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/vhost/vhost.c

index 534d1267b761d23c91a4115e1b8eabc07782da4d..172da092107e8775f666bfad84c01a84129ec85c 100644 (file)
@@ -1612,7 +1612,7 @@ long vhost_vring_ioctl(struct vhost_dev *d, unsigned int ioctl, void __user *arg
                        r = -EFAULT;
                        break;
                }
-               eventfp = f.fd == -1 ? NULL : eventfd_fget(f.fd);
+               eventfp = f.fd == VHOST_FILE_UNBIND ? NULL : eventfd_fget(f.fd);
                if (IS_ERR(eventfp)) {
                        r = PTR_ERR(eventfp);
                        break;
@@ -1628,7 +1628,7 @@ long vhost_vring_ioctl(struct vhost_dev *d, unsigned int ioctl, void __user *arg
                        r = -EFAULT;
                        break;
                }
-               ctx = f.fd == -1 ? NULL : eventfd_ctx_fdget(f.fd);
+               ctx = f.fd == VHOST_FILE_UNBIND ? NULL : eventfd_ctx_fdget(f.fd);
                if (IS_ERR(ctx)) {
                        r = PTR_ERR(ctx);
                        break;
@@ -1640,7 +1640,7 @@ long vhost_vring_ioctl(struct vhost_dev *d, unsigned int ioctl, void __user *arg
                        r = -EFAULT;
                        break;
                }
-               ctx = f.fd == -1 ? NULL : eventfd_ctx_fdget(f.fd);
+               ctx = f.fd == VHOST_FILE_UNBIND ? NULL : eventfd_ctx_fdget(f.fd);
                if (IS_ERR(ctx)) {
                        r = PTR_ERR(ctx);
                        break;
@@ -1765,7 +1765,7 @@ long vhost_dev_ioctl(struct vhost_dev *d, unsigned int ioctl, void __user *argp)
                r = get_user(fd, (int __user *)argp);
                if (r < 0)
                        break;
-               ctx = fd == -1 ? NULL : eventfd_ctx_fdget(fd);
+               ctx = fd == VHOST_FILE_UNBIND ? NULL : eventfd_ctx_fdget(fd);
                if (IS_ERR(ctx)) {
                        r = PTR_ERR(ctx);
                        break;