linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans de Goede <hansg@kernel.org>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	linux-media@vger.kernel.org
Cc: Ricardo Ribalda <ribalda@chromium.org>
Subject: Re: [PATCH 1/3] media: uvcvideo: Drop unneeded memset() in meta device ioctl handlers
Date: Mon, 21 Jul 2025 17:28:21 +0200	[thread overview]
Message-ID: <2032a1a5-c162-4e3f-acbf-58e57fbd772f@kernel.org> (raw)
In-Reply-To: <20250715185254.6592-2-laurent.pinchart@ideasonboard.com>

Hi,

On 15-Jul-25 8:52 PM, 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 <laurent.pinchart@ideasonboard.com>

Thanks, patch looks good to me:

Reviewed-by: Hans de Goede <hansg@kernel.org>

Regards,

Hans



> ---
>  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 229e08ff323e..b68bfb2d47df 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 *fh,
>  	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 *fh,
>  	struct v4l2_fh *vfh = file->private_data;
>  	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;
>  }


  parent reply	other threads:[~2025-07-21 15:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-15 18:52 [PATCH 0/3] media: uvcvideo: Misc fixes Laurent Pinchart
2025-07-15 18:52 ` [PATCH 1/3] media: uvcvideo: Drop unneeded memset() in meta device ioctl handlers Laurent Pinchart
2025-07-16 10:48   ` Ricardo Ribalda
2025-07-21 15:28   ` Hans de Goede [this message]
2025-07-15 18:52 ` [PATCH 2/3] media: uvcvideo: Add missing curly braces Laurent Pinchart
2025-07-16 10:47   ` Ricardo Ribalda
2025-07-16 11:51     ` Laurent Pinchart
2025-07-21 15:28   ` Hans de Goede
2025-07-15 18:52 ` [PATCH 3/3] media: uvcvideo: Move MSXU_CONTROL_METADATA definition to header Laurent Pinchart
2025-07-16 10:46   ` Ricardo Ribalda
2025-07-21 15:35     ` Hans de Goede
2025-07-21 15:29   ` Hans de Goede
2025-07-21 15:38 ` [PATCH 0/3] media: uvcvideo: Misc fixes Hans de Goede

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2032a1a5-c162-4e3f-acbf-58e57fbd772f@kernel.org \
    --to=hansg@kernel.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=ribalda@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).