[PATCH] hwrng: stm32 - Fix runtime PM cleanup on registration failure

Herbert Xu herbert at gondor.apana.org.au
Sun Jul 26 17:35:58 PDT 2026


On Sat, Jul 18, 2026 at 11:29:37AM +0800, Can Peng wrote:
> stm32_rng_probe() enables autosuspend and runtime PM before registering the
> hwrng. If devm_hwrng_register() fails, probe returns with runtime PM left
> enabled and autosuspend still selected.
> 
> The remove callback also only disables runtime PM and does not undo
> pm_runtime_use_autosuspend().
> 
> Use devm_pm_runtime_enable() so runtime PM is unwound automatically on
> probe failure and driver detach. Since the managed cleanup also disables
> runtime PM,drop the remove callback.
> 
> Fixes: c6a97c42e399 ("hwrng: stm32 - add support for STM32 HW RNG")
> Cc: stable at vger.kernel.org
> Signed-off-by: Can Peng <pengcan at kylinos.cn>
> ---
>  drivers/char/hw_random/stm32-rng.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert at gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



More information about the linux-arm-kernel mailing list