On Wed Jun 10 12:22:36 2026 +0200, Jurison Murati wrote:
> ov8865_s_stream() takes a runtime PM reference when enabling the
> stream, but returns without releasing it if ov8865_sw_standby()
> fails, leaving the reference unbalanced and the sensor powered
> indefinitely. The same applies to a failure while disabling the
> stream, in which case the reference acquired at stream start is
> never dropped.
> 
> Drop the reference in a single place, both when disabling the
> stream and on failure, and only update the streaming state on
> success.
> 
> Signed-off-by: Jurison Murati <[email protected]>
> Reviewed-by: Daniel Scally <[email protected]>
> Signed-off-by: Sakari Ailus <[email protected]>

Patch committed.

Thanks,
Sakari Ailus

 drivers/media/i2c/ov8865.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

---

diff --git a/drivers/media/i2c/ov8865.c b/drivers/media/i2c/ov8865.c
index a8586df14f77..5b909a856128 100644
--- a/drivers/media/i2c/ov8865.c
+++ b/drivers/media/i2c/ov8865.c
@@ -2621,15 +2621,13 @@ static int ov8865_s_stream(struct v4l2_subdev *subdev, 
int enable)
        ret = ov8865_sw_standby(sensor, !enable);
        mutex_unlock(&sensor->mutex);
 
-       if (ret)
-               return ret;
-
-       state->streaming = !!enable;
-
-       if (!enable)
+       if (ret || !enable)
                pm_runtime_put(sensor->dev);
 
-       return 0;
+       if (!ret)
+               state->streaming = enable;
+
+       return ret;
 }
 
 static const struct v4l2_subdev_video_ops ov8865_subdev_video_ops = {
_______________________________________________
linuxtv-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to