Commit 0cdbabf8 authored by Łukasz Stelmach's avatar Łukasz Stelmach Committed by Herbert Xu
Browse files

hwrng: exynos - Fix runtime PM imbalance on error



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: default avatarŁukasz Stelmach <l.stelmach@samsung.com>
Reviewed-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent b51dcf05
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -132,7 +132,7 @@ static int exynos_trng_probe(struct platform_device *pdev)
		return PTR_ERR(trng->mem);
		return PTR_ERR(trng->mem);


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


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


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