media: v4l2-ctrls: Move v4l2_fh retrieval after V4L2_FL_USES_V4L2_FH check

JIRA: https://redhat.atlassian.net/browse/RHEL-162130

commit 5410bad3326f3557a7d996b19fa4adc2c70b3c0e
Author: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Date: Sun, 10 Aug 2025 04:30:12 +0300

  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+renesas@ideasonboard.com>
  Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>

Signed-off-by: Kate Hsuan <hpa@redhat.com>
This commit is contained in:
Kate Hsuan
2026-05-15 14:40:00 +08:00
parent abf3d08a18
commit 37c922a5bb
+5 -2
View File
@@ -1248,11 +1248,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);