remoteproc: qcom: pas: fix error handling in adsp_pds_enable
authorZhang Qilong <zhangqilong3@huawei.com>
Mon, 2 Nov 2020 14:35:54 +0000 (22:35 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 Dec 2020 10:53:48 +0000 (11:53 +0100)
commitf1bf8c9f49adacb32584b1213b94a813ec565cf3
treeb3b07ed5ba9d7e3a76dba2979d7bb945b24c37f7
parentcce77d667f5586d1b3a92ce0cbefa1c3156e9c8b
remoteproc: qcom: pas: fix error handling in adsp_pds_enable

[ Upstream commit c0a6e5ee1ecfe4c3a5799cfd30820748eff5dfab ]

If the pm_runtime_get_sync failed in adsp_pds_enable when
loop (i), The unroll_pd_votes will start from (i - 1), and
it will resulted in following problems:

  1) pm_runtime_get_sync will increment pm usage counter even it
     failed. Forgetting to pm_runtime_put_noidle will result in
     reference leak.

  2) Have not reset pds[i] performance state.

Then we fix it.

Fixes: 17ee2fb4e8567 ("remoteproc: qcom: pas: Vote for active/proxy power domains")
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
Link: https://lore.kernel.org/r/20201102143554.144707-1-zhangqilong3@huawei.com
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/remoteproc/qcom_q6v5_pas.c