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

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Laurent Pinchart and committed by
Hans Verkuil
1dcfbdb3 e8e65d92

+2 -9
+2 -9
drivers/media/usb/uvc/uvc_metadata.c
··· 49 49 if (format->type != vfh->vdev->queue->type) 50 50 return -EINVAL; 51 51 52 - memset(fmt, 0, sizeof(*fmt)); 53 - 54 52 fmt->dataformat = stream->meta.format; 55 53 fmt->buffersize = UVC_METADATA_BUF_SIZE; 56 54 ··· 116 118 struct v4l2_fh *vfh = file_to_v4l2_fh(file); 117 119 struct uvc_streaming *stream = video_get_drvdata(vfh->vdev); 118 120 struct uvc_device *dev = stream->dev; 119 - u32 i = fdesc->index; 120 121 121 122 if (fdesc->type != vfh->vdev->queue->type) 122 123 return -EINVAL; 123 124 124 - if (i >= dev->nmeta_formats) 125 + if (fdesc->index >= dev->nmeta_formats) 125 126 return -EINVAL; 126 127 127 - memset(fdesc, 0, sizeof(*fdesc)); 128 - 129 - fdesc->type = vfh->vdev->queue->type; 130 - fdesc->index = i; 131 - fdesc->pixelformat = dev->meta_formats[i]; 128 + fdesc->pixelformat = dev->meta_formats[fdesc->index]; 132 129 133 130 return 0; 134 131 }