Skip to content

Commit

Permalink
scsi: ufs: ti-j721e-ufs: Fix unwinding of pm_runtime changes
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
r-vignesh authored and martinkpetersen committed May 27, 2020
1 parent b6170a4 commit 22617e2
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions drivers/scsi/ufs/ti-j721e-ufs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
}
Expand Down

0 comments on commit 22617e2

Please sign in to comment.