diff options
| author | Zhang Qilong <zhangqilong3@huawei.com> | 2020-11-02 22:34:33 +0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-12-30 11:51:23 +0100 |
| commit | f61bce4bc8336b4fc75dce777be6462f0d981872 (patch) | |
| tree | 27758369ae2b23efdf2c90539402b8b9e684bbd5 /drivers/remoteproc | |
| parent | 9b54e31fd08f8d8db507d021c88e760d5f8e4640 (diff) | |
| download | linux-f61bce4bc8336b4fc75dce777be6462f0d981872.tar.gz linux-f61bce4bc8336b4fc75dce777be6462f0d981872.tar.bz2 linux-f61bce4bc8336b4fc75dce777be6462f0d981872.zip | |
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>
Diffstat (limited to 'drivers/remoteproc')
| -rw-r--r-- | drivers/remoteproc/qcom_q6v5_mss.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/remoteproc/qcom_q6v5_mss.c b/drivers/remoteproc/qcom_q6v5_mss.c index a67c55785b4d..5e54e6f5edb1 100644 --- a/drivers/remoteproc/qcom_q6v5_mss.c +++ b/drivers/remoteproc/qcom_q6v5_mss.c @@ -331,8 +331,11 @@ static int q6v5_pds_enable(struct q6v5 *qproc, struct device **pds, for (i = 0; i < pd_count; i++) { dev_pm_genpd_set_performance_state(pds[i], INT_MAX); ret = pm_runtime_get_sync(pds[i]); - if (ret < 0) + if (ret < 0) { + pm_runtime_put_noidle(pds[i]); + dev_pm_genpd_set_performance_state(pds[i], 0); goto unroll_pd_votes; + } } return 0; |
