This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: i2c: st-mipid02: correct format propagation
Author:  Alain Volmat <alain.vol...@foss.st.com>
Date:    Mon Nov 13 15:57:30 2023 +0100

Use a copy of the struct v4l2_subdev_format when propagating
format from the sink to source pad in order to avoid impacting the
sink format returned to the application.

Thanks to Jacopo Mondi for pointing the issue.

Fixes: 6c01e6f3f27b ("media: st-mipid02: Propagate format from sink to source 
pad")
Signed-off-by: Alain Volmat <alain.vol...@foss.st.com>
Cc: sta...@vger.kernel.org
Reviewed-by: Jacopo Mondi <jacopo.mo...@ideasonboard.com>
Reviewed-by: Daniel Scally <dan.sca...@ideasonboard.com>
Reviewed-by: Benjamin Mugnier <benjamin.mugn...@foss.st.com>
Signed-off-by: Sakari Ailus <sakari.ai...@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-ci...@xs4all.nl>

 drivers/media/i2c/st-mipid02.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

---

diff --git a/drivers/media/i2c/st-mipid02.c b/drivers/media/i2c/st-mipid02.c
index b08a249b5fdd..914f915749a8 100644
--- a/drivers/media/i2c/st-mipid02.c
+++ b/drivers/media/i2c/st-mipid02.c
@@ -769,6 +769,7 @@ static void mipid02_set_fmt_sink(struct v4l2_subdev *sd,
                                 struct v4l2_subdev_format *format)
 {
        struct mipid02_dev *bridge = to_mipid02_dev(sd);
+       struct v4l2_subdev_format source_fmt;
        struct v4l2_mbus_framefmt *fmt;
 
        format->format.code = get_fmt_code(format->format.code);
@@ -780,8 +781,12 @@ static void mipid02_set_fmt_sink(struct v4l2_subdev *sd,
 
        *fmt = format->format;
 
-       /* Propagate the format change to the source pad */
-       mipid02_set_fmt_source(sd, sd_state, format);
+       /*
+        * Propagate the format change to the source pad, taking
+        * care not to update the format pointer given back to user
+        */
+       source_fmt = *format;
+       mipid02_set_fmt_source(sd, sd_state, &source_fmt);
 }
 
 static int mipid02_set_fmt(struct v4l2_subdev *sd,

_______________________________________________
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to