From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Prabhakar <prabhakar.csengg@gmail.com>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Hans Verkuil <hverkuil-cisco@xs4all.nl>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-renesas-soc@vger.kernel.org,
Biju Das <biju.das.jz@bp.renesas.com>,
Fabrizio Castro <fabrizio.castro.jz@renesas.com>,
Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Subject: Re: [PATCH v2] v4l2-subdev: Return -EOPNOTSUPP for unsupported pad type in call_get_frame_desc()
Date: Mon, 7 Oct 2024 21:16:54 +0300 [thread overview]
Message-ID: <20241007181654.GD14766@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20241007123809.89281-1-prabhakar.mahadev-lad.rj@bp.renesas.com>
Hi Prabhakar,
Thank you for the patch.
On Mon, Oct 07, 2024 at 01:38:09PM +0100, Prabhakar wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>
> The `get_frame_desc()` operation should always be called on a source pad,
> which is indicated by the `MEDIA_PAD_FL_SOURCE` flag. This patch adds a
> check in `call_get_frame_desc()` to ensure that the `MEDIA_PAD_FL_SOURCE`
> flag is set for the pad before invoking `get_frame_desc()`. If the pad is
> not a source pad, the function will return an `-EOPNOTSUPP` error,
> signaling that the operation is not supported on non-source pads.
>
> Suggested-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> ---
> v1->v2
> - Added a check for CONFIG_MEDIA_CONTROLLER, as the `entity` member in
> `struct v4l2_subdev` is only available when CONFIG_MEDIA_CONTROLLER
> is enabled.
> ---
> drivers/media/v4l2-core/v4l2-subdev.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
> index de9ac67574bb..446fbc3805c7 100644
> --- a/drivers/media/v4l2-core/v4l2-subdev.c
> +++ b/drivers/media/v4l2-core/v4l2-subdev.c
> @@ -325,6 +325,11 @@ static int call_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
> unsigned int i;
> int ret;
>
> +#if defined(CONFIG_MEDIA_CONTROLLER)
> + if (!(sd->entity.pads[pad].flags & MEDIA_PAD_FL_SOURCE))
As this should really not happen, I wonder if we shouldn't be more
vocal:
if (WARN_ON(!(sd->entity.pads[pad].flags & MEDIA_PAD_FL_SOURCE)))
Sakari, what do you think ? Either way,
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> + return -EOPNOTSUPP;
> +#endif
> +
> memset(fd, 0, sizeof(*fd));
>
> ret = sd->ops->pad->get_frame_desc(sd, pad, fd);
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2024-10-07 18:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-07 12:38 [PATCH v2] v4l2-subdev: Return -EOPNOTSUPP for unsupported pad type in call_get_frame_desc() Prabhakar
2024-10-07 18:16 ` Laurent Pinchart [this message]
2024-10-09 6:01 ` Sakari Ailus
2024-10-09 14:57 ` 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=20241007181654.GD14766@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=biju.das.jz@bp.renesas.com \
--cc=fabrizio.castro.jz@renesas.com \
--cc=hverkuil-cisco@xs4all.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=prabhakar.csengg@gmail.com \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
--cc=sakari.ailus@linux.intel.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