diff mbox series

scsi: ufs: Fix runtime PM imbalance on error

Message ID 20200522045335.30556-1-dinghao.liu@zju.edu.cn (mailing list archive)
State Superseded
Headers show
Series scsi: ufs: Fix runtime PM imbalance on error | expand

Commit Message

Dinghao Liu May 22, 2020, 4:53 a.m. UTC
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(+)

Comments

Vignesh Raghavendra May 26, 2020, 10:07 a.m. UTC | #1
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
Dinghao Liu May 26, 2020, 10:12 a.m. UTC | #2
> 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
diff mbox series

Patch

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