All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] remoteproc: qcom: pas: fix error handling in adsp_pds_enable
@ 2020-11-02 14:35 Zhang Qilong
  2020-11-18 14:30 ` patchwork-bot+linux-remoteproc
  2020-12-29 20:15 ` patchwork-bot+linux-arm-msm
  0 siblings, 2 replies; 3+ messages in thread
From: Zhang Qilong @ 2020-11-02 14:35 UTC (permalink / raw)
  To: agross, bjorn.andersson, ohad; +Cc: linux-arm-msm, linux-remoteproc

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>
---
 drivers/remoteproc/qcom_q6v5_pas.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c
index 3837f23995e0..0678b417707e 100644
--- a/drivers/remoteproc/qcom_q6v5_pas.c
+++ b/drivers/remoteproc/qcom_q6v5_pas.c
@@ -90,8 +90,11 @@ static int adsp_pds_enable(struct qcom_adsp *adsp, 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;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] remoteproc: qcom: pas: fix error handling in adsp_pds_enable
  2020-11-02 14:35 [PATCH] remoteproc: qcom: pas: fix error handling in adsp_pds_enable Zhang Qilong
@ 2020-11-18 14:30 ` patchwork-bot+linux-remoteproc
  2020-12-29 20:15 ` patchwork-bot+linux-arm-msm
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+linux-remoteproc @ 2020-11-18 14:30 UTC (permalink / raw)
  To: Zhang Qilong; +Cc: linux-remoteproc

Hello:

This patch was applied to andersson/remoteproc.git (refs/heads/for-next):

On Mon, 2 Nov 2020 22:35:54 +0800 you wrote:
> 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.
> 
> [...]

Here is the summary with links:
  - remoteproc: qcom: pas: fix error handling in adsp_pds_enable
    https://git.kernel.org/andersson/remoteproc/c/2b9de1272fbd

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] remoteproc: qcom: pas: fix error handling in adsp_pds_enable
  2020-11-02 14:35 [PATCH] remoteproc: qcom: pas: fix error handling in adsp_pds_enable Zhang Qilong
  2020-11-18 14:30 ` patchwork-bot+linux-remoteproc
@ 2020-12-29 20:15 ` patchwork-bot+linux-arm-msm
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+linux-arm-msm @ 2020-12-29 20:15 UTC (permalink / raw)
  To: Zhang Qilong; +Cc: linux-arm-msm

Hello:

This patch was applied to qcom/linux.git (refs/heads/for-next):

On Mon, 2 Nov 2020 22:35:54 +0800 you wrote:
> 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.
> 
> [...]

Here is the summary with links:
  - remoteproc: qcom: pas: fix error handling in adsp_pds_enable
    https://git.kernel.org/qcom/c/c0a6e5ee1ecf

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-12-29 20:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-02 14:35 [PATCH] remoteproc: qcom: pas: fix error handling in adsp_pds_enable Zhang Qilong
2020-11-18 14:30 ` patchwork-bot+linux-remoteproc
2020-12-29 20:15 ` patchwork-bot+linux-arm-msm

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.