summaryrefslogtreecommitdiffstats
path: root/virt/kvm
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2024-07-20 02:17:58 +0200
committerAl Viro <viro@zeniv.linux.org.uk>2024-11-03 07:28:06 +0100
commit6348be02eead77bdd1562154ed6b3296ad3b3750 (patch)
treef5d5ecda1f932e56da79fb5d6a6b5e015dd76ec1 /virt/kvm
parentprivcmd_ioeventfd_assign(): don't open-code eventfd_ctx_fdget() (diff)
downloadlinux-6348be02eead77bdd1562154ed6b3296ad3b3750.tar.xz
linux-6348be02eead77bdd1562154ed6b3296ad3b3750.zip
fdget(), trivial conversions
fdget() is the first thing done in scope, all matching fdput() are immediately followed by leaving the scope. Reviewed-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'virt/kvm')
-rw-r--r--virt/kvm/vfio.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/virt/kvm/vfio.c b/virt/kvm/vfio.c
index 388ae471d258..53262b8a7656 100644
--- a/virt/kvm/vfio.c
+++ b/virt/kvm/vfio.c
@@ -190,11 +190,10 @@ static int kvm_vfio_file_del(struct kvm_device *dev, unsigned int fd)
{
struct kvm_vfio *kv = dev->private;
struct kvm_vfio_file *kvf;
- struct fd f;
+ CLASS(fd, f)(fd);
int ret;
- f = fdget(fd);
- if (!fd_file(f))
+ if (fd_empty(f))
return -EBADF;
ret = -ENOENT;
@@ -220,9 +219,6 @@ static int kvm_vfio_file_del(struct kvm_device *dev, unsigned int fd)
kvm_vfio_update_coherency(dev);
mutex_unlock(&kv->lock);
-
- fdput(f);
-
return ret;
}