Skip to content

Commit 1dcfbdb

Browse files
pinchartlHans Verkuil
authored andcommitted
media: uvcvideo: Drop unneeded memset() in meta device ioctl handlers
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 <laurent.pinchart@ideasonboard.com> Reviewed-by: Ricardo Ribalda <ribalda@chromium.org> Reviewed-by: Hans de Goede <hansg@kernel.org> Signed-off-by: Hans de Goede <hansg@kernel.org> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
1 parent e8e65d9 commit 1dcfbdb

1 file changed

Lines changed: 2 additions & 9 deletions

File tree

drivers/media/usb/uvc/uvc_metadata.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ static int uvc_meta_v4l2_get_format(struct file *file, void *priv,
4949
if (format->type != vfh->vdev->queue->type)
5050
return -EINVAL;
5151

52-
memset(fmt, 0, sizeof(*fmt));
53-
5452
fmt->dataformat = stream->meta.format;
5553
fmt->buffersize = UVC_METADATA_BUF_SIZE;
5654

@@ -118,19 +116,14 @@ static int uvc_meta_v4l2_enum_formats(struct file *file, void *priv,
118116
struct v4l2_fh *vfh = file_to_v4l2_fh(file);
119117
struct uvc_streaming *stream = video_get_drvdata(vfh->vdev);
120118
struct uvc_device *dev = stream->dev;
121-
u32 i = fdesc->index;
122119

123120
if (fdesc->type != vfh->vdev->queue->type)
124121
return -EINVAL;
125122

126-
if (i >= dev->nmeta_formats)
123+
if (fdesc->index >= dev->nmeta_formats)
127124
return -EINVAL;
128125

129-
memset(fdesc, 0, sizeof(*fdesc));
130-
131-
fdesc->type = vfh->vdev->queue->type;
132-
fdesc->index = i;
133-
fdesc->pixelformat = dev->meta_formats[i];
126+
fdesc->pixelformat = dev->meta_formats[fdesc->index];
134127

135128
return 0;
136129
}

0 commit comments

Comments
 (0)