lkml.org 
[lkml]   [2021]   [Apr]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] hwrng: exynos - Fix runtime PM imbalance on error
Date
pm_runtime_get_sync() increments the runtime PM usage counter even
the call returns an error code. Thus a pairing decrement is needed
on the error handling path to keep the counter balanced.

Change-Id: I028915fbee9e4a050a1313119872d6043696632d
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
---
drivers/char/hw_random/exynos-trng.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/char/hw_random/exynos-trng.c b/drivers/char/hw_random/exynos-trng.c
index 8e1fe3f8dd2d..9f455d952e87 100644
--- a/drivers/char/hw_random/exynos-trng.c
+++ b/drivers/char/hw_random/exynos-trng.c
@@ -142,13 +142,13 @@ static int exynos_trng_probe(struct platform_device *pdev)
if (IS_ERR(trng->clk)) {
ret = PTR_ERR(trng->clk);
dev_err(&pdev->dev, "Could not get clock.\n");
- goto err_clock;
+ goto err_pm_get;
}

ret = clk_prepare_enable(trng->clk);
if (ret) {
dev_err(&pdev->dev, "Could not enable the clk.\n");
- goto err_clock;
+ goto err_pm_get;
}

ret = devm_hwrng_register(&pdev->dev, &trng->rng);
@@ -164,10 +164,8 @@ static int exynos_trng_probe(struct platform_device *pdev)
err_register:
clk_disable_unprepare(trng->clk);

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

return ret;
--
2.26.2
\
 
 \ /
  Last update: 2021-04-22 12:17    [W:0.021 / U:1.276 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site