Skip to content

Commit

Permalink
hwrng: exynos - Fix runtime PM imbalance on error
Browse files Browse the repository at this point in the history
[ Upstream commit 0cdbabf ]

pm_runtime_resume_and_get() wraps around pm_runtime_get_sync() and
decrements the runtime PM usage counter in case the latter function
fails and keeps the counter balanced.

Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Łukasz Stelmach authored and gregkh committed Jul 14, 2021
1 parent 3c51d82 commit 4e8c951
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/char/hw_random/exynos-trng.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ static int exynos_trng_probe(struct platform_device *pdev)
return PTR_ERR(trng->mem);

pm_runtime_enable(&pdev->dev);
ret = pm_runtime_get_sync(&pdev->dev);
ret = pm_runtime_resume_and_get(&pdev->dev);
if (ret < 0) {
dev_err(&pdev->dev, "Could not get runtime PM.\n");
goto err_pm_get;
Expand Down Expand Up @@ -165,7 +165,7 @@ static int exynos_trng_probe(struct platform_device *pdev)
clk_disable_unprepare(trng->clk);

err_clock:
pm_runtime_put_sync(&pdev->dev);
pm_runtime_put_noidle(&pdev->dev);

err_pm_get:
pm_runtime_disable(&pdev->dev);
Expand Down

0 comments on commit 4e8c951

Please sign in to comment.