linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: ufs: Fix runtime PM imbalance on error
@ 2020-05-22  4:53 Dinghao Liu
  2020-05-26 10:07 ` Vignesh Raghavendra
  0 siblings, 1 reply; 3+ messages in thread
From: Dinghao Liu @ 2020-05-22  4:53 UTC (permalink / raw)
  To: dinghao.liu, kjlu
  Cc: Alim Akhtar, Avri Altman, James E.J. Bottomley,
	Martin K. Petersen, Vignesh Raghavendra, linux-scsi,
	linux-kernel

When devm_clk_get() returns an error code, a pairing
runtime PM usage counter decrement is needed to keep
the counter balanced.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
---
 drivers/scsi/ufs/ti-j721e-ufs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/ufs/ti-j721e-ufs.c b/drivers/scsi/ufs/ti-j721e-ufs.c
index 5216d228cdd9..f3f212f6f9a9 100644
--- a/drivers/scsi/ufs/ti-j721e-ufs.c
+++ b/drivers/scsi/ufs/ti-j721e-ufs.c
@@ -39,6 +39,7 @@ static int ti_j721e_ufs_probe(struct platform_device *pdev)
 	clk = devm_clk_get(dev, NULL);
 	if (IS_ERR(clk)) {
 		dev_err(dev, "Cannot claim MPHY clock.\n");
+		pm_runtime_put_sync(dev);
 		return PTR_ERR(clk);
 	}
 	clk_rate = clk_get_rate(clk);
-- 
2.17.1


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

* Re: [PATCH] scsi: ufs: Fix runtime PM imbalance on error
  2020-05-22  4:53 [PATCH] scsi: ufs: Fix runtime PM imbalance on error Dinghao Liu
@ 2020-05-26 10:07 ` Vignesh Raghavendra
  2020-05-26 10:12   ` dinghao.liu
  0 siblings, 1 reply; 3+ messages in thread
From: Vignesh Raghavendra @ 2020-05-26 10:07 UTC (permalink / raw)
  To: Dinghao Liu, kjlu
  Cc: Alim Akhtar, Avri Altman, James E.J. Bottomley,
	Martin K. Petersen, linux-scsi, linux-kernel

Hi,

On 22/05/20 10:23 am, Dinghao Liu wrote:
> When devm_clk_get() returns an error code, a pairing
> runtime PM usage counter decrement is needed to keep
> the counter balanced.
> 
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
> ---

Thanks for the patch! But this fix is incomplete, I have posted 
a more comprehensive fix at [1].. Please take a look!

[1] https://lore.kernel.org/linux-scsi/20200526100340.15032-1-vigneshr@ti.com/T/#u

>  drivers/scsi/ufs/ti-j721e-ufs.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/scsi/ufs/ti-j721e-ufs.c b/drivers/scsi/ufs/ti-j721e-ufs.c
> index 5216d228cdd9..f3f212f6f9a9 100644
> --- a/drivers/scsi/ufs/ti-j721e-ufs.c
> +++ b/drivers/scsi/ufs/ti-j721e-ufs.c
> @@ -39,6 +39,7 @@ static int ti_j721e_ufs_probe(struct platform_device *pdev)
>  	clk = devm_clk_get(dev, NULL);
>  	if (IS_ERR(clk)) {
>  		dev_err(dev, "Cannot claim MPHY clock.\n");
> +		pm_runtime_put_sync(dev);
>  		return PTR_ERR(clk);
>  	}
>  	clk_rate = clk_get_rate(clk);
> 


Regards
Vignesh

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

* Re: Re: [PATCH] scsi: ufs: Fix runtime PM imbalance on error
  2020-05-26 10:07 ` Vignesh Raghavendra
@ 2020-05-26 10:12   ` dinghao.liu
  0 siblings, 0 replies; 3+ messages in thread
From: dinghao.liu @ 2020-05-26 10:12 UTC (permalink / raw)
  To: Vignesh Raghavendra
  Cc: kjlu, Alim Akhtar, Avri Altman, James E.J. Bottomley,
	Martin K. Petersen, linux-scsi, linux-kernel

> Hi,
> 
> On 22/05/20 10:23 am, Dinghao Liu wrote:
> > When devm_clk_get() returns an error code, a pairing
> > runtime PM usage counter decrement is needed to keep
> > the counter balanced.
> > 
> > Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
> > ---
> 
> Thanks for the patch! But this fix is incomplete, I have posted 
> a more comprehensive fix at [1].. Please take a look!


You are right, we should call pm_runtime_disable() on error, too.
Thank your for your reminder!

Regards,
Dinghao

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

end of thread, other threads:[~2020-05-26 10:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-22  4:53 [PATCH] scsi: ufs: Fix runtime PM imbalance on error Dinghao Liu
2020-05-26 10:07 ` Vignesh Raghavendra
2020-05-26 10:12   ` dinghao.liu

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).