If the .s_stream() handler fails after calling pm_runtime_get_sync(),
call pm_runtime_put() in the error path.
While at it add a few blank lines to make the code more readable.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
return ret;
mipi_csis_clear_counters(state);
+
ret = pm_runtime_get_sync(&state->pdev->dev);
if (ret < 0) {
pm_runtime_put_noidle(&state->pdev->dev);
}
ret = v4l2_subdev_call(state->src_sd, core, s_power, 1);
if (ret < 0 && ret != -ENOIOCTLCMD)
- return ret;
+ goto done;
}
mutex_lock(&state->lock);
+
if (enable) {
if (state->flags & ST_SUSPENDED) {
ret = -EBUSY;
unlock:
mutex_unlock(&state->lock);
- if (!enable)
+
+done:
+ if (!enable || ret < 0)
pm_runtime_put(&state->pdev->dev);
return ret;