[PATCH 62/65] media: v4l2-ctrls: Move v4l2_fh retrieval after V4L2_FL_USES_V4L2_FH check
Jacopo Mondi <jacopo.mondi-ryLnwIuWjnjg/[email protected]> Sat, 02 Aug 2025 11:23:24 +0200
| Newsgroups | gmane.linux.ports.tegra,gmane.linux.drivers.video-input-infrastructure,gmane.linux.kernel,gmane.linux.documentation,gmane.linux.ports.arm.kernel,gmane.linux.ports.arm.mediatek,gmane.linux.kernel.renesas-soc,gmane.linux.ports.arm.msm,gmane.linux.kernel.samsung-soc,gmane.linux.usb.general,gmane.linux.ports.arm.rockchip,gmane.comp.video.mjpeg.user |
|---|---|
| Message-ID | <[email protected]> |
From: Laurent Pinchart <laurent.pinchart-ryLnwIuWjnjg/[email protected]> The v4l2_ctrl_log_status() function retrieves the v4l2_fh from the file with file_to_v4l2_fh() before checking the V4L2_FL_USES_V4L2_FH to see if the device makes use of v4l2_fh. While this doesn't cause any practical issue given the current implementation of file_to_v4l2_fh(), it is cleaner to retrieve the v4l2_fh after checking the flag. This could prevent future issues if the implementation of file_to_v4l2_fh() changes. Signed-off-by: Laurent Pinchart <laurent.pinchart-ryLnwIuWjnjg/[email protected]> Signed-off-by: Jacopo Mondi <jacopo.mondi-ryLnwIuWjnjg/[email protected]> --- drivers/media/v4l2-core/v4l2-ctrls-api.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-ctrls-api.c b/drivers/media/v4l2-core/v4l2-ctrls-api.c index d46b2c8f3d23596293210125b148c3da99c52cac..b0bba8eec143968b127368ee7de8bca76b427dbd 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls-api.c +++ b/drivers/media/v4l2-core/v4l2-ctrls-api.c @@ -1253,11 +1253,14 @@ EXPORT_SYMBOL(v4l2_querymenu); int v4l2_ctrl_log_status(struct file *file, void *fh) { struct video_device *vfd = video_devdata(file); - struct v4l2_fh *vfh = file_to_v4l2_fh(file); - if (test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags) && vfd->v4l2_dev) + if (test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags) && vfd->v4l2_dev) { + struct v4l2_fh *vfh = file_to_v4l2_fh(file); + v4l2_ctrl_handler_log_status(vfh->ctrl_handler, vfd->v4l2_dev->name); + } + return 0; } EXPORT_SYMBOL(v4l2_ctrl_log_status); -- 2.49.0