Linux cryptographic layer development
 help / color / mirror / Atom feed
* [PATCH] hwrng: omap: disable runtime PM on resume failure
@ 2026-06-26  9:02 Myeonghun Pak
  2026-06-26  9:07 ` Myeonghun Pak
  0 siblings, 1 reply; 2+ messages in thread
From: Myeonghun Pak @ 2026-06-26  9:02 UTC (permalink / raw)
  To: Deepak Saxena
  Cc: Olivia Mackall, Herbert Xu, linux-crypto, linux-kernel,
	Myeonghun Pak, Ijae Kim

omap_rng_probe() enables runtime PM before calling
pm_runtime_resume_and_get().  If the resume call fails, the error path
currently jumps to err_ioremap and returns without disabling runtime PM
again.

Add a runtime-PM-only error label and route the resume failure through it.
The label is placed after the runtime PM usage-count unwind, so later
probe failures keep using the existing pm_runtime_put_sync() path while
this early failure only disables the runtime PM state that was already
enabled.

Fixes: 61dc0a446e5d ("hwrng: omap - Fix assumption that runtime_get_sync will always succeed")
Co-developed-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
---
 drivers/char/hw_random/omap-rng.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/char/hw_random/omap-rng.c b/drivers/char/hw_random/omap-rng.c
index 5e8b50f15dc3..44b8bb4a24a8 100644
--- a/drivers/char/hw_random/omap-rng.c
+++ b/drivers/char/hw_random/omap-rng.c
@@ -455,7 +455,7 @@ static int omap_rng_probe(struct platform_device *pdev)
 	ret = pm_runtime_resume_and_get(&pdev->dev);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "Failed to runtime_get device: %d\n", ret);
-		goto err_ioremap;
+		goto err_pm_disable;
 	}
 
 	priv->clk = devm_clk_get(&pdev->dev, NULL);
@@ -499,6 +499,7 @@ err_register:
 err_register:
 	priv->base = NULL;
 	pm_runtime_put_sync(&pdev->dev);
+err_pm_disable:
 	pm_runtime_disable(&pdev->dev);
 
 	clk_disable_unprepare(priv->clk_reg);
-- 
2.47.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] hwrng: omap: disable runtime PM on resume failure
  2026-06-26  9:02 [PATCH] hwrng: omap: disable runtime PM on resume failure Myeonghun Pak
@ 2026-06-26  9:07 ` Myeonghun Pak
  0 siblings, 0 replies; 2+ messages in thread
From: Myeonghun Pak @ 2026-06-26  9:07 UTC (permalink / raw)
  To: Deepak Saxena
  Cc: Olivia Mackall, Herbert Xu, linux-crypto, linux-kernel, Ijae Kim

Please ignore this patch.

I noticed after sending it that this patch was not properly checked
against the existing omap-rng probe error-path cleanup discussion, and
it should not be reviewed as-is.

Sorry for the noise.

Thanks,
Myeonghun

2026년 6월 26일 (금) 오후 6:03, Myeonghun Pak <mhun512@gmail.com>님이 작성:
>
> omap_rng_probe() enables runtime PM before calling
> pm_runtime_resume_and_get().  If the resume call fails, the error path
> currently jumps to err_ioremap and returns without disabling runtime PM
> again.
>
> Add a runtime-PM-only error label and route the resume failure through it.
> The label is placed after the runtime PM usage-count unwind, so later
> probe failures keep using the existing pm_runtime_put_sync() path while
> this early failure only disables the runtime PM state that was already
> enabled.
>
> Fixes: 61dc0a446e5d ("hwrng: omap - Fix assumption that runtime_get_sync will always succeed")
> Co-developed-by: Ijae Kim <ae878000@gmail.com>
> Signed-off-by: Ijae Kim <ae878000@gmail.com>
> Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
> ---
>  drivers/char/hw_random/omap-rng.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/char/hw_random/omap-rng.c b/drivers/char/hw_random/omap-rng.c
> index 5e8b50f15dc3..44b8bb4a24a8 100644
> --- a/drivers/char/hw_random/omap-rng.c
> +++ b/drivers/char/hw_random/omap-rng.c
> @@ -455,7 +455,7 @@ static int omap_rng_probe(struct platform_device *pdev)
>         ret = pm_runtime_resume_and_get(&pdev->dev);
>         if (ret < 0) {
>                 dev_err(&pdev->dev, "Failed to runtime_get device: %d\n", ret);
> -               goto err_ioremap;
> +               goto err_pm_disable;
>         }
>
>         priv->clk = devm_clk_get(&pdev->dev, NULL);
> @@ -499,6 +499,7 @@ err_register:
>  err_register:
>         priv->base = NULL;
>         pm_runtime_put_sync(&pdev->dev);
> +err_pm_disable:
>         pm_runtime_disable(&pdev->dev);
>
>         clk_disable_unprepare(priv->clk_reg);
> --
> 2.47.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-26  9:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-26  9:02 [PATCH] hwrng: omap: disable runtime PM on resume failure Myeonghun Pak
2026-06-26  9:07 ` Myeonghun Pak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox