media: i2c: ov8865: Drop the runtime PM usage count on stream failure

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 <eng.juri@gmail.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
This commit is contained in:
Jurison Murati 2026-06-10 12:22:36 +02:00 committed by Sakari Ailus
parent 253c9659e2
commit 3fe797a12b

View File

@ -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 = {