media: venus: core: Fix runtime PM imbalance in venus_probe
authorDinghao Liu <dinghao.liu@zju.edu.cn>
Sun, 28 Jun 2020 05:55:23 +0000 (07:55 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Oct 2020 09:08:21 +0000 (10:08 +0100)
commitd5772580c1091e69b64fe3eed553c4d65f097a69
tree88e8cab6125f2605b0b25cb2e8583d509ba7906d
parent6ed15eebcb61f67ca972d9f4341b703b4fb297c8
media: venus: core: Fix runtime PM imbalance in venus_probe

[ Upstream commit bbe516e976fce538db96bd2b7287df942faa14a3 ]

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>
drivers/media/platform/qcom/venus/core.c