On Tue Jul 15 21:52:52 2025 +0300, Laurent Pinchart wrote:
> The .vidioc_g_fmt_meta_cap() and .vidioc_enum_fmt_meta_cap() ioctl
> handlers for meta capture devices memset the ioctl argument structure to
> zero. This is unnecessary as the memory is already zeroed by the V4L2
> ioctl core. Drop the memset(), which, in uvc_meta_v4l2_enum_formats(),
> also allows further simplification as structure fields don't need to be
> saved and restored.
>
> Signed-off-by: Laurent Pinchart <[email protected]>
> Reviewed-by: Ricardo Ribalda <[email protected]>
> Reviewed-by: Hans de Goede <[email protected]>
> Signed-off-by: Hans de Goede <[email protected]>
> Signed-off-by: Hans Verkuil <[email protected]>
Patch committed.
Thanks,
Hans Verkuil
drivers/media/usb/uvc/uvc_metadata.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
---
diff --git a/drivers/media/usb/uvc/uvc_metadata.c
b/drivers/media/usb/uvc/uvc_metadata.c
index b0960f0553cf..02c47cc8ad1e 100644
--- a/drivers/media/usb/uvc/uvc_metadata.c
+++ b/drivers/media/usb/uvc/uvc_metadata.c
@@ -49,8 +49,6 @@ static int uvc_meta_v4l2_get_format(struct file *file, void
*priv,
if (format->type != vfh->vdev->queue->type)
return -EINVAL;
- memset(fmt, 0, sizeof(*fmt));
-
fmt->dataformat = stream->meta.format;
fmt->buffersize = UVC_METADATA_BUF_SIZE;
@@ -118,19 +116,14 @@ static int uvc_meta_v4l2_enum_formats(struct file *file,
void *priv,
struct v4l2_fh *vfh = file_to_v4l2_fh(file);
struct uvc_streaming *stream = video_get_drvdata(vfh->vdev);
struct uvc_device *dev = stream->dev;
- u32 i = fdesc->index;
if (fdesc->type != vfh->vdev->queue->type)
return -EINVAL;
- if (i >= dev->nmeta_formats)
+ if (fdesc->index >= dev->nmeta_formats)
return -EINVAL;
- memset(fdesc, 0, sizeof(*fdesc));
-
- fdesc->type = vfh->vdev->queue->type;
- fdesc->index = i;
- fdesc->pixelformat = dev->meta_formats[i];
+ fdesc->pixelformat = dev->meta_formats[fdesc->index];
return 0;
}