summaryrefslogtreecommitdiffstats
path: root/virt/kvm
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2024-07-19 20:17:58 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2024-11-03 01:28:06 -0500
commit6348be02eead77bdd1562154ed6b3296ad3b3750 (patch)
treef5d5ecda1f932e56da79fb5d6a6b5e015dd76ec1 /virt/kvm
parent46b5e18ae8a5b122f21b2e5ce385cf8688a0413f (diff)
downloadlinux-stable-6348be02eead77bdd1562154ed6b3296ad3b3750.tar.gz
linux-stable-6348be02eead77bdd1562154ed6b3296ad3b3750.tar.bz2
linux-stable-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;
}