Commit 8f5586dc authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Mauro Carvalho Chehab

media: imx: imx7_mipi_csis: Runtime suspend in .s_stream() error path

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: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: default avatarRui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 212d34e0
...@@ -694,6 +694,7 @@ static int mipi_csis_s_stream(struct v4l2_subdev *mipi_sd, int enable) ...@@ -694,6 +694,7 @@ static int mipi_csis_s_stream(struct v4l2_subdev *mipi_sd, int enable)
return ret; return ret;
mipi_csis_clear_counters(state); mipi_csis_clear_counters(state);
ret = pm_runtime_get_sync(&state->pdev->dev); ret = pm_runtime_get_sync(&state->pdev->dev);
if (ret < 0) { if (ret < 0) {
pm_runtime_put_noidle(&state->pdev->dev); pm_runtime_put_noidle(&state->pdev->dev);
...@@ -701,10 +702,11 @@ static int mipi_csis_s_stream(struct v4l2_subdev *mipi_sd, int enable) ...@@ -701,10 +702,11 @@ static int mipi_csis_s_stream(struct v4l2_subdev *mipi_sd, int enable)
} }
ret = v4l2_subdev_call(state->src_sd, core, s_power, 1); ret = v4l2_subdev_call(state->src_sd, core, s_power, 1);
if (ret < 0 && ret != -ENOIOCTLCMD) if (ret < 0 && ret != -ENOIOCTLCMD)
return ret; goto done;
} }
mutex_lock(&state->lock); mutex_lock(&state->lock);
if (enable) { if (enable) {
if (state->flags & ST_SUSPENDED) { if (state->flags & ST_SUSPENDED) {
ret = -EBUSY; ret = -EBUSY;
...@@ -732,7 +734,9 @@ static int mipi_csis_s_stream(struct v4l2_subdev *mipi_sd, int enable) ...@@ -732,7 +734,9 @@ static int mipi_csis_s_stream(struct v4l2_subdev *mipi_sd, int enable)
unlock: unlock:
mutex_unlock(&state->lock); mutex_unlock(&state->lock);
if (!enable)
done:
if (!enable || ret < 0)
pm_runtime_put(&state->pdev->dev); pm_runtime_put(&state->pdev->dev);
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment