Skip to content

Commit

Permalink
drm_syncobj: switch to fdget()
Browse files Browse the repository at this point in the history
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed May 2, 2019
1 parent 95ce0bc commit fb38624
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions drivers/gpu/drm/drm_syncobj.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,20 +388,19 @@ static int drm_syncobj_fd_to_handle(struct drm_file *file_private,
int fd, u32 *handle)
{
struct drm_syncobj *syncobj;
struct file *file;
struct fd f = fdget(fd);
int ret;

file = fget(fd);
if (!file)
if (!f.file)
return -EINVAL;

if (file->f_op != &drm_syncobj_file_fops) {
fput(file);
if (f.file->f_op != &drm_syncobj_file_fops) {
fdput(f);
return -EINVAL;
}

/* take a reference to put in the idr */
syncobj = file->private_data;
syncobj = f.file->private_data;
drm_syncobj_get(syncobj);

idr_preload(GFP_KERNEL);
Expand All @@ -416,7 +415,7 @@ static int drm_syncobj_fd_to_handle(struct drm_file *file_private,
} else
drm_syncobj_put(syncobj);

fput(file);
fdput(f);
return ret;
}

Expand Down

0 comments on commit fb38624

Please sign in to comment.