Skip to content

Commit

Permalink
media: sun4i_v4l2: use pm_runtime_resume_and_get()
Browse files Browse the repository at this point in the history
Commit dd8088d ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter")
added pm_runtime_resume_and_get() in order to automatically handle
dev->power.usage_count decrement on errors.

Use the new API, in order to cleanup the error check logic.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
  • Loading branch information
mchehab authored and intel-lab-lkp committed Apr 24, 2021
1 parent fffc1bb commit ddf22a4
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions drivers/media/platform/sunxi/sun4i-csi/sun4i_v4l2.c
Expand Up @@ -206,9 +206,9 @@ static int sun4i_csi_open(struct file *file)
if (ret)
return ret;

ret = pm_runtime_get_sync(csi->dev);
ret = pm_runtime_resume_and_get(csi->dev);
if (ret < 0)
goto err_pm_put;
goto err_unlock;

ret = v4l2_pipeline_pm_get(&csi->vdev.entity);
if (ret)
Expand All @@ -225,8 +225,7 @@ static int sun4i_csi_open(struct file *file)
err_pipeline_pm_put:
v4l2_pipeline_pm_put(&csi->vdev.entity);

err_pm_put:
pm_runtime_put(csi->dev);
err_unlock:
mutex_unlock(&csi->lock);

return ret;
Expand Down

0 comments on commit ddf22a4

Please sign in to comment.