Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: switch to fdget()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro 3b85d302 fb386243

+8 -8
+8 -8
drivers/media/media-request.c
··· 246 246 struct media_request * 247 247 media_request_get_by_fd(struct media_device *mdev, int request_fd) 248 248 { 249 - struct file *filp; 249 + struct fd f; 250 250 struct media_request *req; 251 251 252 252 if (!mdev || !mdev->ops || 253 253 !mdev->ops->req_validate || !mdev->ops->req_queue) 254 254 return ERR_PTR(-EACCES); 255 255 256 - filp = fget(request_fd); 257 - if (!filp) 256 + f = fdget(request_fd); 257 + if (!f.file) 258 258 goto err_no_req_fd; 259 259 260 - if (filp->f_op != &request_fops) 260 + if (f.file->f_op != &request_fops) 261 261 goto err_fput; 262 - req = filp->private_data; 262 + req = f.file->private_data; 263 263 if (req->mdev != mdev) 264 264 goto err_fput; 265 265 266 266 /* 267 267 * Note: as long as someone has an open filehandle of the request, 268 - * the request can never be released. The fget() above ensures that 268 + * the request can never be released. The fdget() above ensures that 269 269 * even if userspace closes the request filehandle, the release() 270 270 * fop won't be called, so the media_request_get() always succeeds 271 271 * and there is no race condition where the request was released 272 272 * before media_request_get() is called. 273 273 */ 274 274 media_request_get(req); 275 - fput(filp); 275 + fdput(f); 276 276 277 277 return req; 278 278 279 279 err_fput: 280 - fput(filp); 280 + fdput(f); 281 281 282 282 err_no_req_fd: 283 283 dev_dbg(mdev->dev, "cannot find request_fd %d\n", request_fd);