remoteproc: q6v5-mss: fix error handling in q6v5_pds_enable
authorZhang Qilong <zhangqilong3@huawei.com>
Mon, 2 Nov 2020 14:34:33 +0000 (22:34 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 Dec 2020 10:53:48 +0000 (11:53 +0100)
commit70ea4c7d1d39020cff13f8a3ca7404b8cce296fa
tree2b559f68cd97992ab16e0f118a00e2ef90713133
parent01e2c27b8a30e5fc2211d28fc9133d8eca37adc8
remoteproc: q6v5-mss: fix error handling in q6v5_pds_enable

[ Upstream commit a24723050037303e4008b37f1f8dcc99c58901aa ]

If the pm_runtime_get_sync failed in q6v5_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: 4760a896be88e ("remoteproc: q6v5-mss: Vote for rpmh power domains")
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
Link: https://lore.kernel.org/r/20201102143433.143996-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_mss.c