Linux Media Controller development
 help / color / mirror / Atom feed
From: Stefan Klug <stefan.klug@ideasonboard.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	linux-media@vger.kernel.org
Cc: Nicolas Dufresne <nicolas.dufresne@collabora.com>,
	Xavier Roumegue <xavier.roumegue@oss.nxp.com>
Subject: Re: [PATCH 10/25] media: dw100: Drop unneeded v4l2_m2m_get_vq() NULL check
Date: Fri, 10 Oct 2025 10:40:41 +0200	[thread overview]
Message-ID: <176008564130.3214037.17279403493128702940@localhost> (raw)
In-Reply-To: <20251008175052.19925-11-laurent.pinchart@ideasonboard.com>

Hi Laurent,

Thank you for the patch.

Quoting Laurent Pinchart (2025-10-08 19:50:37)
> The v4l2_m2m_get_vq() function never returns NULL.
> 
> In the set format handler, the check may have been intended to catch
> invalid format types, but that's not needed as the V4L2 core picks the
> appropriate VIDIOC_S_FMT ioctl handler based on the format type, so the
> type can't be incorrect.
> 
> In the get format handler, the return value is not used for any purpose
> other than the NULL check, which was therefore probably intended to
> catch invalid format types. That's not needed for the same reason as in
> the set format handler.
> 
> Drop the unneeded return value checks and, as the function has no side
> effect, the unneeded function call as well.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> 

Cheers,
Stefan

> ---
>  drivers/media/platform/nxp/dw100/dw100.c | 7 -------
>  1 file changed, 7 deletions(-)
> 
> diff --git a/drivers/media/platform/nxp/dw100/dw100.c b/drivers/media/platform/nxp/dw100/dw100.c
> index fed1788d0702..7a0ee44d9e1f 100644
> --- a/drivers/media/platform/nxp/dw100/dw100.c
> +++ b/drivers/media/platform/nxp/dw100/dw100.c
> @@ -765,13 +765,8 @@ static int dw100_enum_framesizes(struct file *file, void *priv,
>  static int dw100_g_fmt_vid(struct file *file, void *priv, struct v4l2_format *f)
>  {
>         struct dw100_ctx *ctx = dw100_file2ctx(file);
> -       struct vb2_queue *vq;
>         struct dw100_q_data *q_data;
>  
> -       vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, f->type);
> -       if (!vq)
> -               return -EINVAL;
> -
>         q_data = dw100_get_q_data(ctx, f->type);
>  
>         f->fmt.pix_mp = q_data->pix_fmt;
> @@ -833,8 +828,6 @@ static int dw100_s_fmt(struct dw100_ctx *ctx, struct v4l2_format *f)
>         struct vb2_queue *vq;
>  
>         vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, f->type);
> -       if (!vq)
> -               return -EINVAL;
>  
>         q_data = dw100_get_q_data(ctx, f->type);
>         if (!q_data)
> -- 
> Regards,
> 
> Laurent Pinchart
> 
>

  reply	other threads:[~2025-10-10  8:40 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-08 17:50 [PATCH 00/25] media: v4l2-mem2mem: Reduce cargo-cult Laurent Pinchart
2025-10-08 17:50 ` [PATCH 01/25] media: v4l2-mem2mem: Document that v4l2_m2m_get_vq() never returns NULL Laurent Pinchart
2025-10-10  8:35   ` Stefan Klug
2025-10-08 17:50 ` [PATCH 02/25] media: allgro-dvt: Drop unneeded v4l2_m2m_get_vq() NULL check Laurent Pinchart
2025-10-08 17:50 ` [PATCH 03/25] media: meson-g2d: " Laurent Pinchart
2025-10-08 18:13   ` Neil Armstrong
2025-10-08 17:50 ` [PATCH 04/25] media: amphion: " Laurent Pinchart
2025-10-08 17:50 ` [PATCH 05/25] media: coda: " Laurent Pinchart
2025-10-09  8:11   ` Philipp Zabel
2025-10-08 17:50 ` [PATCH 06/25] media: imagination: e5010: " Laurent Pinchart
2025-10-08 17:50 ` [PATCH 07/25] media: m2m-deinterlace: " Laurent Pinchart
2025-10-08 17:50 ` [PATCH 08/25] media: mediatek: jpeg: " Laurent Pinchart
2025-10-08 17:50 ` [PATCH 09/25] media: mediatek: vcodec: " Laurent Pinchart
2025-10-08 17:50 ` [PATCH 10/25] media: dw100: " Laurent Pinchart
2025-10-10  8:40   ` Stefan Klug [this message]
2025-10-08 17:50 ` [PATCH 11/25] media: imx-jpeg: " Laurent Pinchart
2025-10-08 20:01   ` Frank Li
2025-10-08 17:50 ` [PATCH 12/25] media: imx-pxp: " Laurent Pinchart
2025-10-08 20:02   ` Frank Li
2025-10-09  8:11   ` Philipp Zabel
2025-10-08 17:50 ` [PATCH 13/25] media: nxp: imx8-isi: " Laurent Pinchart
2025-10-08 20:02   ` Frank Li
2025-10-08 17:50 ` [PATCH 14/25] media: mx2_emmaprp: " Laurent Pinchart
2025-10-08 17:50 ` [PATCH 15/25] media: qcom: iris: " Laurent Pinchart
2025-10-08 23:51   ` Bryan O'Donoghue
2025-10-09 13:53   ` Dikshita Agarwal
2025-10-10 11:14     ` Laurent Pinchart
2025-10-08 17:50 ` [PATCH 16/25] media: qcom: venus: " Laurent Pinchart
2025-10-08 23:52   ` Bryan O'Donoghue
2025-10-09  7:42   ` Dikshita Agarwal
2025-10-08 17:50 ` [PATCH 17/25] media: renesas: fdp1: " Laurent Pinchart
2025-10-08 17:50 ` [PATCH 18/25] media: rcar_jpu: " Laurent Pinchart
2025-10-08 17:50 ` [PATCH 19/25] media: platform: rga: " Laurent Pinchart
2025-10-08 17:50 ` [PATCH 20/25] media: samsung: s5p-g2d: " Laurent Pinchart
2025-10-10 11:00   ` Lukasz Stelmach
2025-10-08 17:50 ` [PATCH 21/25] media: samsung: s5p-jpeg: " Laurent Pinchart
2025-10-08 17:50 ` [PATCH 22/25] media: stm32: dma2d: " Laurent Pinchart
2025-10-08 17:50 ` [PATCH 23/25] media: ti: vpe: " Laurent Pinchart
2025-10-08 17:50 ` [PATCH 24/25] media: vicodec: " Laurent Pinchart
2025-10-08 17:50 ` [PATCH 25/25] media: vim2m: " Laurent Pinchart
2025-10-08 18:24 ` [PATCH 00/25] media: v4l2-mem2mem: Reduce cargo-cult Nicolas Dufresne
2025-10-08 19:21   ` Laurent Pinchart

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=176008564130.3214037.17279403493128702940@localhost \
    --to=stefan.klug@ideasonboard.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=nicolas.dufresne@collabora.com \
    --cc=xavier.roumegue@oss.nxp.com \
    /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