Skip to content

Commit 22617e2

Browse files
r-vigneshmartinkpetersen
authored andcommitted
scsi: ufs: ti-j721e-ufs: Fix unwinding of pm_runtime changes
Fix unwinding of pm_runtime changes when bailing out of driver probe due to a failure and also on removal of driver. Link: https://lore.kernel.org/r/[email protected] Fixes: 6979e56 ("scsi: ufs: Add driver for TI wrapper for Cadence UFS IP") Reported-by: Dinghao Liu <[email protected]> Signed-off-by: Vignesh Raghavendra <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent b6170a4 commit 22617e2

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

drivers/scsi/ufs/ti-j721e-ufs.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ static int ti_j721e_ufs_probe(struct platform_device *pdev)
3232
ret = pm_runtime_get_sync(dev);
3333
if (ret < 0) {
3434
pm_runtime_put_noidle(dev);
35-
return ret;
35+
goto disable_pm;
3636
}
3737

3838
/* Select MPHY refclk frequency */
3939
clk = devm_clk_get(dev, NULL);
4040
if (IS_ERR(clk)) {
4141
dev_err(dev, "Cannot claim MPHY clock.\n");
42-
return PTR_ERR(clk);
42+
goto clk_err;
4343
}
4444
clk_rate = clk_get_rate(clk);
4545
if (clk_rate == 26000000)
@@ -54,16 +54,23 @@ static int ti_j721e_ufs_probe(struct platform_device *pdev)
5454
dev);
5555
if (ret) {
5656
dev_err(dev, "failed to populate child nodes %d\n", ret);
57-
pm_runtime_put_sync(dev);
57+
goto clk_err;
5858
}
5959

6060
return ret;
61+
62+
clk_err:
63+
pm_runtime_put_sync(dev);
64+
disable_pm:
65+
pm_runtime_disable(dev);
66+
return ret;
6167
}
6268

6369
static int ti_j721e_ufs_remove(struct platform_device *pdev)
6470
{
6571
of_platform_depopulate(&pdev->dev);
6672
pm_runtime_put_sync(&pdev->dev);
73+
pm_runtime_disable(&pdev->dev);
6774

6875
return 0;
6976
}

0 commit comments

Comments
 (0)