Skip to content

Commit

Permalink
media: coda: Fix runtime PM imbalance on error
Browse files Browse the repository at this point in the history
pm_runtime_get_sync() increments the runtime PM usage counter even
when it returns an error code. Thus a pairing decrement is needed on
the error handling path to keep the counter balanced.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
  • Loading branch information
dinghaoliu authored and mchehab committed Jun 23, 2020
1 parent e40a877 commit 9036169
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/media/platform/coda/coda-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -2653,7 +2653,7 @@ static int coda_open(struct file *file)

ret = clk_prepare_enable(dev->clk_per);
if (ret)
goto err_clk_per;
goto err_pm_get;

ret = clk_prepare_enable(dev->clk_ahb);
if (ret)
Expand Down Expand Up @@ -2692,9 +2692,8 @@ static int coda_open(struct file *file)
clk_disable_unprepare(dev->clk_ahb);
err_clk_ahb:
clk_disable_unprepare(dev->clk_per);
err_clk_per:
pm_runtime_put_sync(dev->dev);
err_pm_get:
pm_runtime_put_sync(dev->dev);
v4l2_fh_del(&ctx->fh);
v4l2_fh_exit(&ctx->fh);
err_coda_name_init:
Expand Down

0 comments on commit 9036169

Please sign in to comment.