summaryrefslogtreecommitdiff
path: root/virt
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2024-07-19 21:19:02 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2024-11-03 01:28:06 -0500
commit8152f8201088350c76bb9685cd5990dd51d59aff (patch)
treed8c16f772fd79b751e19b29d420b6818239c94e6 /virt
parent6348be02eead77bdd1562154ed6b3296ad3b3750 (diff)
fdget(), more trivial conversions
all failure exits prior to fdget() leave the scope, all matching fdput() are immediately followed by leaving the scope. [xfs_ioc_commit_range() chunk moved here as well] Reviewed-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/vfio.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/virt/kvm/vfio.c b/virt/kvm/vfio.c
index 53262b8a7656..72aa1fdeb699 100644
--- a/virt/kvm/vfio.c
+++ b/virt/kvm/vfio.c
@@ -229,14 +229,13 @@ static int kvm_vfio_file_set_spapr_tce(struct kvm_device *dev,
struct kvm_vfio_spapr_tce param;
struct kvm_vfio *kv = dev->private;
struct kvm_vfio_file *kvf;
- struct fd f;
int ret;
if (copy_from_user(&param, arg, sizeof(struct kvm_vfio_spapr_tce)))
return -EFAULT;
- f = fdget(param.groupfd);
- if (!fd_file(f))
+ CLASS(fd, f)(param.groupfd);
+ if (fd_empty(f))
return -EBADF;
ret = -ENOENT;
@@ -262,7 +261,6 @@ static int kvm_vfio_file_set_spapr_tce(struct kvm_device *dev,
err_fdput:
mutex_unlock(&kv->lock);
- fdput(f);
return ret;
}
#endif