From: Michael Grzeschik <m.grzesc...@pengutronix.de>

Currently set_fmt don't care about the streaming status, so the format
can be changed during streaming. This can lead into wrong behaviours.

Check if the device is already streaming and return -EBUSY to avoid
wrong behaviours.

Signed-off-by: Michael Grzeschik <m.grzesc...@pengutronix.de>
Signed-off-by: Marco Felsch <m.fel...@pengutronix.de>
Reviewed-by: Philipp Zabel <p.za...@pengutronix.de>
---
 drivers/media/i2c/mt9m111.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/media/i2c/mt9m111.c b/drivers/media/i2c/mt9m111.c
index e0ac5aa6ea64..1f8789fe28af 100644
--- a/drivers/media/i2c/mt9m111.c
+++ b/drivers/media/i2c/mt9m111.c
@@ -560,6 +560,9 @@ static int mt9m111_set_fmt(struct v4l2_subdev *sd,
        bool bayer;
        int ret;
 
+       if (mt9m111->is_streaming)
+               return -EBUSY;
+
        if (format->pad)
                return -EINVAL;
 
-- 
2.19.1

Reply via email to