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>
This commit is contained in:
Al Viro
2024-07-19 20:17:58 -04:00
parent 46b5e18ae8
commit 6348be02ee
31 changed files with 164 additions and 339 deletions

View File

@@ -712,16 +712,14 @@ static int drm_syncobj_fd_to_handle(struct drm_file *file_private,
int fd, u32 *handle)
{
struct drm_syncobj *syncobj;
struct fd f = fdget(fd);
CLASS(fd, f)(fd);
int ret;
if (!fd_file(f))
if (fd_empty(f))
return -EINVAL;
if (fd_file(f)->f_op != &drm_syncobj_file_fops) {
fdput(f);
if (fd_file(f)->f_op != &drm_syncobj_file_fops)
return -EINVAL;
}
/* take a reference to put in the idr */
syncobj = fd_file(f)->private_data;
@@ -739,7 +737,6 @@ static int drm_syncobj_fd_to_handle(struct drm_file *file_private,
} else
drm_syncobj_put(syncobj);
fdput(f);
return ret;
}