Re: [PATCH] hwrng: omap: Fix probe error path cleanup
From: Herbert Xu
Date: Sun Jul 05 2026 - 04:41:18 EST
On Tue, Jun 23, 2026 at 05:42:23PM +0900, Myeonghun Pak wrote:
> omap_rng_probe() enables runtime PM before acquiring and enabling the
> functional clocks. Several later error paths returned or unwound without
> undoing all state acquired so far.
>
> If pm_runtime_resume_and_get() failed, the driver returned through the
> generic ioremap error label and left runtime PM enabled. If either clock
> lookup returned -EPROBE_DEFER, the function returned directly and skipped
> the runtime PM cleanup; the register clock defer path could also leave the
> already enabled functional clock prepared.
>
> Route these failures through the existing unwind labels so each path only
> undoes resources that were acquired successfully. Keep the resume failure
> path limited to pm_runtime_disable(), and use the later labels only after
> the runtime PM usage count or clocks have been acquired.
>
> This issue was identified during our ongoing static-analysis research while
> reviewing kernel code.
>
> Fixes: 61dc0a446e5d ("hwrng: omap - Fix assumption that runtime_get_sync will always succeed")
> Fixes: 43ec540e6f9b ("hwrng: omap - move clock related code to omap_rng_probe()")
> Fixes: b166be004491 ("hwrng: omap - Fix clock resource by adding a register clock")
> Co-developed-by: Ijae Kim <ae878000@xxxxxxxxx>
> Signed-off-by: Ijae Kim <ae878000@xxxxxxxxx>
> Signed-off-by: Myeonghun Pak <mhun512@xxxxxxxxx>
>
> ---
> drivers/char/hw_random/omap-rng.c | 30 ++++++++++++++++++++----------
> 1 file changed, 20 insertions(+), 10 deletions(-)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt