Skip to content

Commit

Permalink
media: venus: core: Fix runtime PM imbalance in venus_probe
Browse files Browse the repository at this point in the history
[ Upstream commit bbe516e ]

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. For other error
paths after this call, things are the same.

Fix this by adding pm_runtime_put_noidle() after 'err_runtime_disable'
label. But in this case, the error path after pm_runtime_put_sync()
will decrease PM usage counter twice. Thus add an extra
pm_runtime_get_noresume() in this path to balance PM counter.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
dinghaoliu authored and gregkh committed Oct 29, 2020
1 parent 6ed15ee commit d577258
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/media/platform/qcom/venus/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,10 @@ static int venus_probe(struct platform_device *pdev)
goto err_core_deinit;

ret = pm_runtime_put_sync(dev);
if (ret)
if (ret) {
pm_runtime_get_noresume(dev);
goto err_dev_unregister;
}

return 0;

Expand All @@ -301,6 +303,7 @@ static int venus_probe(struct platform_device *pdev)
err_venus_shutdown:
venus_shutdown(core);
err_runtime_disable:
pm_runtime_put_noidle(dev);
pm_runtime_set_suspended(dev);
pm_runtime_disable(dev);
hfi_destroy(core);
Expand Down

0 comments on commit d577258

Please sign in to comment.