linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] HSI: Fix PM usage counter unbalance in ssi_hw_init
@ 2020-11-23 10:18 Zhang Qilong
  2021-01-02  0:43 ` Sebastian Reichel
  0 siblings, 1 reply; 2+ messages in thread
From: Zhang Qilong @ 2020-11-23 10:18 UTC (permalink / raw)
  To: sre; +Cc: gustavoars, carlos.chinea, linux-kernel

pm_runtime_get_sync will increment pm usage counter
even it failed. Forgetting to putting operation will
result in reference leak here. We fix it by replacing
it with pm_runtime_resume_and_get to keep usage counter
balanced.

Fixes: b209e047bc743 ("HSI: Introduce OMAP SSI driver")
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
---
 drivers/hsi/controllers/omap_ssi_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hsi/controllers/omap_ssi_core.c b/drivers/hsi/controllers/omap_ssi_core.c
index fa69b94debd9..b4ac2f8cb9f9 100644
--- a/drivers/hsi/controllers/omap_ssi_core.c
+++ b/drivers/hsi/controllers/omap_ssi_core.c
@@ -424,7 +424,7 @@ static int ssi_hw_init(struct hsi_controller *ssi)
 	struct omap_ssi_controller *omap_ssi = hsi_controller_drvdata(ssi);
 	int err;
 
-	err = pm_runtime_get_sync(ssi->device.parent);
+	err = pm_runtime_resume_and_get(ssi->device.parent);
 	if (err < 0) {
 		dev_err(&ssi->device, "runtime PM failed %d\n", err);
 		return err;
-- 
2.25.4


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

* Re: [PATCH] HSI: Fix PM usage counter unbalance in ssi_hw_init
  2020-11-23 10:18 [PATCH] HSI: Fix PM usage counter unbalance in ssi_hw_init Zhang Qilong
@ 2021-01-02  0:43 ` Sebastian Reichel
  0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Reichel @ 2021-01-02  0:43 UTC (permalink / raw)
  To: Zhang Qilong; +Cc: gustavoars, carlos.chinea, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1213 bytes --]

Hi,

On Mon, Nov 23, 2020 at 06:18:27PM +0800, Zhang Qilong wrote:
> pm_runtime_get_sync will increment pm usage counter
> even it failed. Forgetting to putting operation will
> result in reference leak here. We fix it by replacing
> it with pm_runtime_resume_and_get to keep usage counter
> balanced.
> 
> Fixes: b209e047bc743 ("HSI: Introduce OMAP SSI driver")
> Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
> ---

Thanks, queued.

-- Sebastian

>  drivers/hsi/controllers/omap_ssi_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hsi/controllers/omap_ssi_core.c b/drivers/hsi/controllers/omap_ssi_core.c
> index fa69b94debd9..b4ac2f8cb9f9 100644
> --- a/drivers/hsi/controllers/omap_ssi_core.c
> +++ b/drivers/hsi/controllers/omap_ssi_core.c
> @@ -424,7 +424,7 @@ static int ssi_hw_init(struct hsi_controller *ssi)
>  	struct omap_ssi_controller *omap_ssi = hsi_controller_drvdata(ssi);
>  	int err;
>  
> -	err = pm_runtime_get_sync(ssi->device.parent);
> +	err = pm_runtime_resume_and_get(ssi->device.parent);
>  	if (err < 0) {
>  		dev_err(&ssi->device, "runtime PM failed %d\n", err);
>  		return err;
> -- 
> 2.25.4
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2021-01-02  0:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-23 10:18 [PATCH] HSI: Fix PM usage counter unbalance in ssi_hw_init Zhang Qilong
2021-01-02  0:43 ` Sebastian Reichel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).