linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: ufs: ti-j721e-ufs: Fix unwinding of pm_runtime changes
@ 2020-05-26 10:03 Vignesh Raghavendra
  2020-05-27  2:13 ` Martin K. Petersen
  0 siblings, 1 reply; 2+ messages in thread
From: Vignesh Raghavendra @ 2020-05-26 10:03 UTC (permalink / raw)
  To: jejb, martin.petersen
  Cc: Alim Akhtar, Avri Altman, Vignesh Raghavendra, linux-scsi,
	linux-kernel, Dinghao Liu

Fix unwinding of pm_runtime changes when bailing out of driver probe due
to a failure and also on removal of driver.

Fixes: 6979e56cec97 ("scsi: ufs: Add driver for TI wrapper for Cadence UFS IP")
Reported-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
---
 drivers/scsi/ufs/ti-j721e-ufs.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/ufs/ti-j721e-ufs.c b/drivers/scsi/ufs/ti-j721e-ufs.c
index 5216d228cdd9..46bb905b4d6a 100644
--- a/drivers/scsi/ufs/ti-j721e-ufs.c
+++ b/drivers/scsi/ufs/ti-j721e-ufs.c
@@ -32,14 +32,14 @@ static int ti_j721e_ufs_probe(struct platform_device *pdev)
 	ret = pm_runtime_get_sync(dev);
 	if (ret < 0) {
 		pm_runtime_put_noidle(dev);
-		return ret;
+		goto disable_pm;
 	}
 
 	/* Select MPHY refclk frequency */
 	clk = devm_clk_get(dev, NULL);
 	if (IS_ERR(clk)) {
 		dev_err(dev, "Cannot claim MPHY clock.\n");
-		return PTR_ERR(clk);
+		goto clk_err;
 	}
 	clk_rate = clk_get_rate(clk);
 	if (clk_rate == 26000000)
@@ -54,16 +54,23 @@ static int ti_j721e_ufs_probe(struct platform_device *pdev)
 				   dev);
 	if (ret) {
 		dev_err(dev, "failed to populate child nodes %d\n", ret);
-		pm_runtime_put_sync(dev);
+		goto clk_err;
 	}
 
 	return ret;
+
+clk_err:
+	pm_runtime_put_sync(dev);
+disable_pm:
+	pm_runtime_disable(dev);
+	return ret;
 }
 
 static int ti_j721e_ufs_remove(struct platform_device *pdev)
 {
 	of_platform_depopulate(&pdev->dev);
 	pm_runtime_put_sync(&pdev->dev);
+	pm_runtime_disable(&pdev->dev);
 
 	return 0;
 }
-- 
2.26.2


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

* Re: [PATCH] scsi: ufs: ti-j721e-ufs: Fix unwinding of pm_runtime changes
  2020-05-26 10:03 [PATCH] scsi: ufs: ti-j721e-ufs: Fix unwinding of pm_runtime changes Vignesh Raghavendra
@ 2020-05-27  2:13 ` Martin K. Petersen
  0 siblings, 0 replies; 2+ messages in thread
From: Martin K. Petersen @ 2020-05-27  2:13 UTC (permalink / raw)
  To: Vignesh Raghavendra, jejb
  Cc: Martin K . Petersen, Avri Altman, Alim Akhtar, linux-scsi,
	Dinghao Liu, linux-kernel

On Tue, 26 May 2020 15:33:40 +0530, Vignesh Raghavendra wrote:

> Fix unwinding of pm_runtime changes when bailing out of driver probe due
> to a failure and also on removal of driver.

Applied to 5.8/scsi-queue, thanks!

[1/1] scsi: ufs: ti-j721e-ufs: Fix unwinding of pm_runtime changes
      https://git.kernel.org/mkp/scsi/c/22617e216331

-- 
Martin K. Petersen	Oracle Linux Engineering

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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-26 10:03 [PATCH] scsi: ufs: ti-j721e-ufs: Fix unwinding of pm_runtime changes Vignesh Raghavendra
2020-05-27  2:13 ` Martin K. Petersen

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