* [PATCH] media: rkisp1: Zero v4l2_subdev_format fields in when validating links
@ 2022-08-23 17:19 Laurent Pinchart
2022-08-24 17:48 ` paul.elder
2022-09-03 3:53 ` Dafna Hirschfeld
0 siblings, 2 replies; 3+ messages in thread
From: Laurent Pinchart @ 2022-08-23 17:19 UTC (permalink / raw)
To: linux-media
Cc: Dafna Hirschfeld, Heiko Stuebner, Florian Sylvestre, Paul Elder
The local sd_fmt variable in rkisp1_capture_link_validate() has
uninitialized fields, which causes random failures when calling the
subdev .get_fmt() operation. Fix it by initialization the variable when
declaring it, which zeros all other fields.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
index 0d5e3373e1f5..28f5bf284314 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
@@ -1394,11 +1394,12 @@ static int rkisp1_capture_link_validate(struct media_link *link)
struct rkisp1_capture *cap = video_get_drvdata(vdev);
const struct rkisp1_capture_fmt_cfg *fmt =
rkisp1_find_fmt_cfg(cap, cap->pix.fmt.pixelformat);
- struct v4l2_subdev_format sd_fmt;
+ struct v4l2_subdev_format sd_fmt = {
+ .which = V4L2_SUBDEV_FORMAT_ACTIVE,
+ .pad = link->source->index,
+ };
int ret;
- sd_fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
- sd_fmt.pad = link->source->index;
ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, &sd_fmt);
if (ret)
return ret;
--
Regards,
Laurent Pinchart
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] media: rkisp1: Zero v4l2_subdev_format fields in when validating links
2022-08-23 17:19 [PATCH] media: rkisp1: Zero v4l2_subdev_format fields in when validating links Laurent Pinchart
@ 2022-08-24 17:48 ` paul.elder
2022-09-03 3:53 ` Dafna Hirschfeld
1 sibling, 0 replies; 3+ messages in thread
From: paul.elder @ 2022-08-24 17:48 UTC (permalink / raw)
To: Laurent Pinchart
Cc: linux-media, Dafna Hirschfeld, Heiko Stuebner, Florian Sylvestre
Hi Laurent,
In the subject: s/in //
On Tue, Aug 23, 2022 at 08:19:30PM +0300, Laurent Pinchart wrote:
> The local sd_fmt variable in rkisp1_capture_link_validate() has
> uninitialized fields, which causes random failures when calling the
> subdev .get_fmt() operation. Fix it by initialization the variable when
s/initialization/initializing/
> declaring it, which zeros all other fields.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
> ---
> drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
> index 0d5e3373e1f5..28f5bf284314 100644
> --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
> +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
> @@ -1394,11 +1394,12 @@ static int rkisp1_capture_link_validate(struct media_link *link)
> struct rkisp1_capture *cap = video_get_drvdata(vdev);
> const struct rkisp1_capture_fmt_cfg *fmt =
> rkisp1_find_fmt_cfg(cap, cap->pix.fmt.pixelformat);
> - struct v4l2_subdev_format sd_fmt;
> + struct v4l2_subdev_format sd_fmt = {
> + .which = V4L2_SUBDEV_FORMAT_ACTIVE,
> + .pad = link->source->index,
> + };
> int ret;
>
> - sd_fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
> - sd_fmt.pad = link->source->index;
> ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, &sd_fmt);
> if (ret)
> return ret;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] media: rkisp1: Zero v4l2_subdev_format fields in when validating links
2022-08-23 17:19 [PATCH] media: rkisp1: Zero v4l2_subdev_format fields in when validating links Laurent Pinchart
2022-08-24 17:48 ` paul.elder
@ 2022-09-03 3:53 ` Dafna Hirschfeld
1 sibling, 0 replies; 3+ messages in thread
From: Dafna Hirschfeld @ 2022-09-03 3:53 UTC (permalink / raw)
To: Laurent Pinchart
Cc: linux-media, Heiko Stuebner, Florian Sylvestre, Paul Elder
On 23.08.2022 20:19, Laurent Pinchart wrote:
>The local sd_fmt variable in rkisp1_capture_link_validate() has
>uninitialized fields, which causes random failures when calling the
>subdev .get_fmt() operation. Fix it by initialization the variable when
>declaring it, which zeros all other fields.
>
>Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com>
>---
> drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
>diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
>index 0d5e3373e1f5..28f5bf284314 100644
>--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
>+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
>@@ -1394,11 +1394,12 @@ static int rkisp1_capture_link_validate(struct media_link *link)
> struct rkisp1_capture *cap = video_get_drvdata(vdev);
> const struct rkisp1_capture_fmt_cfg *fmt =
> rkisp1_find_fmt_cfg(cap, cap->pix.fmt.pixelformat);
>- struct v4l2_subdev_format sd_fmt;
>+ struct v4l2_subdev_format sd_fmt = {
>+ .which = V4L2_SUBDEV_FORMAT_ACTIVE,
>+ .pad = link->source->index,
>+ };
> int ret;
>
>- sd_fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
>- sd_fmt.pad = link->source->index;
> ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, &sd_fmt);
> if (ret)
> return ret;
>--
>Regards,
>
>Laurent Pinchart
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-09-03 3:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-23 17:19 [PATCH] media: rkisp1: Zero v4l2_subdev_format fields in when validating links Laurent Pinchart
2022-08-24 17:48 ` paul.elder
2022-09-03 3:53 ` Dafna Hirschfeld
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).