drm_syncobj: switch to fdget()
authorAl Viro <viro@zeniv.linux.org.uk>
Sun, 14 Apr 2019 16:50:52 +0000 (12:50 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Thu, 2 May 2019 06:25:54 +0000 (02:25 -0400)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
drivers/gpu/drm/drm_syncobj.c

index e19525af0ccee11e39277c589beaeb8811d8c0b2..8bdb4a3bd7bf130d7f2e8fc83dcf4c8eaeb8db74 100644 (file)
@@ -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);
@@ -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;
 }