diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-05-08 06:34:21 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-05-08 06:34:21 +0300 |
commit | d897166d8598e362a31d79dfd9a1e2eedb9ac85c (patch) | |
tree | eb799f89e18e8ae41605e9a7388c6ca9026b0e10 /drivers/media | |
parent | 400913252d09f9cfb8cce33daee43167921fc343 (diff) | |
parent | 3b85d3028e2a0f95a8425fbfa54a04056b7cbc91 (diff) | |
download | linux-d897166d8598e362a31d79dfd9a1e2eedb9ac85c.tar.xz |
Merge branch 'work.file' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs 'struct file' related updates from Al Viro:
"A bit more of 'this fget() would be better off as fdget()'
whack-a-mole + a couple of ->f_count-related cleanups"
* 'work.file' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
media: switch to fdget()
drm_syncobj: switch to fdget()
amdgpu: switch to fdget()
don't open-code file_count()
fs: drop unused fput_atomic definition
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/media-request.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/media/media-request.c b/drivers/media/media-request.c index eec2e2b2f6ec..9e5fd2ac769e 100644 --- a/drivers/media/media-request.c +++ b/drivers/media/media-request.c @@ -246,38 +246,38 @@ static const struct file_operations request_fops = { struct media_request * media_request_get_by_fd(struct media_device *mdev, int request_fd) { - struct file *filp; + struct fd f; struct media_request *req; if (!mdev || !mdev->ops || !mdev->ops->req_validate || !mdev->ops->req_queue) return ERR_PTR(-EACCES); - filp = fget(request_fd); - if (!filp) + f = fdget(request_fd); + if (!f.file) goto err_no_req_fd; - if (filp->f_op != &request_fops) + if (f.file->f_op != &request_fops) goto err_fput; - req = filp->private_data; + req = f.file->private_data; if (req->mdev != mdev) goto err_fput; /* * Note: as long as someone has an open filehandle of the request, - * the request can never be released. The fget() above ensures that + * the request can never be released. The fdget() above ensures that * even if userspace closes the request filehandle, the release() * fop won't be called, so the media_request_get() always succeeds * and there is no race condition where the request was released * before media_request_get() is called. */ media_request_get(req); - fput(filp); + fdput(f); return req; err_fput: - fput(filp); + fdput(f); err_no_req_fd: dev_dbg(mdev->dev, "cannot find request_fd %d\n", request_fd); |