* [PATCH] hwrng: exynos - fix runtime pm imbalance on error
@ 2020-05-20 13:19 Dinghao Liu
[not found] ` <CGME20200521135309eucas1p1c0734570f04660c8b60ea12531f53e60@eucas1p1.samsung.com>
0 siblings, 1 reply; 3+ messages in thread
From: Dinghao Liu @ 2020-05-20 13:19 UTC (permalink / raw)
To: dinghao.liu, kjlu
Cc: Łukasz Stelmach, Matt Mackall, Herbert Xu, Arnd Bergmann,
Greg Kroah-Hartman, Kukjin Kim, Krzysztof Kozlowski,
linux-samsung-soc, linux-crypto, linux-arm-kernel, linux-kernel
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.
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
---
drivers/char/hw_random/exynos-trng.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/char/hw_random/exynos-trng.c b/drivers/char/hw_random/exynos-trng.c
index 8e1fe3f8dd2d..133e017db577 100644
--- a/drivers/char/hw_random/exynos-trng.c
+++ b/drivers/char/hw_random/exynos-trng.c
@@ -165,9 +165,8 @@ static int exynos_trng_probe(struct platform_device *pdev)
clk_disable_unprepare(trng->clk);
err_clock:
- pm_runtime_put_sync(&pdev->dev);
-
err_pm_get:
+ pm_runtime_put_sync(&pdev->dev);
pm_runtime_disable(&pdev->dev);
return ret;
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] hwrng: exynos - fix runtime pm imbalance on error
[not found] ` <CGME20200521135309eucas1p1c0734570f04660c8b60ea12531f53e60@eucas1p1.samsung.com>
@ 2020-05-21 13:52 ` Lukasz Stelmach
0 siblings, 0 replies; 3+ messages in thread
From: Lukasz Stelmach @ 2020-05-21 13:52 UTC (permalink / raw)
To: Dinghao Liu
Cc: kjlu, Matt Mackall, Herbert Xu, Arnd Bergmann,
Greg Kroah-Hartman, Kukjin Kim, Krzysztof Kozlowski,
linux-samsung-soc, linux-crypto, linux-arm-kernel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1221 bytes --]
It was <2020-05-20 śro 21:19>, when Dinghao Liu wrote:
> 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.
>
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
> ---
> drivers/char/hw_random/exynos-trng.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/char/hw_random/exynos-trng.c b/drivers/char/hw_random/exynos-trng.c
> index 8e1fe3f8dd2d..133e017db577 100644
> --- a/drivers/char/hw_random/exynos-trng.c
> +++ b/drivers/char/hw_random/exynos-trng.c
> @@ -165,9 +165,8 @@ static int exynos_trng_probe(struct platform_device *pdev)
> clk_disable_unprepare(trng->clk);
>
> err_clock:
> - pm_runtime_put_sync(&pdev->dev);
> -
> err_pm_get:
> + pm_runtime_put_sync(&pdev->dev);
> pm_runtime_disable(&pdev->dev);
>
> return ret;
You are right. I will accept the patch, when you remove the err_clock
label and and change goto instructions above to point to
err_pm_get. There is no point in having two labels.
Thank you.
--
Łukasz Stelmach
Samsung R&D Institute Poland
Samsung Electronics
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] hwrng: exynos - Fix runtime PM imbalance on error
[not found] <CGME20210422101724eucas1p13e2f002b63fe94ef2aa5268383f3a207@eucas1p1.samsung.com>
@ 2021-04-22 10:17 ` Łukasz Stelmach
0 siblings, 0 replies; 3+ messages in thread
From: Łukasz Stelmach @ 2021-04-22 10:17 UTC (permalink / raw)
To: Matt Mackall, Herbert Xu, Krzysztof Kozlowski, linux-samsung-soc,
linux-crypto, linux-arm-kernel, linux-kernel
Cc: Bartłomiej Żolnierkiewicz, Marek Szyprowski,
Łukasz Stelmach
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-04-22 10:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-20 13:19 [PATCH] hwrng: exynos - fix runtime pm imbalance on error Dinghao Liu
[not found] ` <CGME20200521135309eucas1p1c0734570f04660c8b60ea12531f53e60@eucas1p1.samsung.com>
2020-05-21 13:52 ` Lukasz Stelmach
[not found] <CGME20210422101724eucas1p13e2f002b63fe94ef2aa5268383f3a207@eucas1p1.samsung.com>
2021-04-22 10:17 ` [PATCH] hwrng: exynos - Fix runtime PM " Łukasz Stelmach
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).