2023-12-01 08:40:14

by Yang Yingliang

[permalink] [raw]
Subject: [PATCH] hwrng: stm32 - add missing clk_disable_unprepare() in stm32_rng_init()

From: Yang Yingliang <[email protected]>

Add clk_disable_unprepare() in the error path in stm32_rng_init().

Fixes: 6b85a7e141cb ("hwrng: stm32 - implement STM32MP13x support")
Signed-off-by: Yang Yingliang <[email protected]>
---
drivers/char/hw_random/stm32-rng.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/char/hw_random/stm32-rng.c b/drivers/char/hw_random/stm32-rng.c
index 41e1dbea5d2e..efd6edcd7066 100644
--- a/drivers/char/hw_random/stm32-rng.c
+++ b/drivers/char/hw_random/stm32-rng.c
@@ -325,6 +325,7 @@ static int stm32_rng_init(struct hwrng *rng)
(!(reg & RNG_CR_CONDRST)),
10, 50000);
if (err) {
+ clk_disable_unprepare(priv->clk);
dev_err((struct device *)priv->rng.priv,
"%s: timeout %x!\n", __func__, reg);
return -EINVAL;
--
2.25.1



2023-12-01 10:39:01

by Gatien CHEVALLIER

[permalink] [raw]
Subject: Re: [PATCH] hwrng: stm32 - add missing clk_disable_unprepare() in stm32_rng_init()

Hi Yang,

Good spot, thank you.

Reviewed-by: Gatien Chevallier <[email protected]>

Best regards,
Gatien

On 12/1/23 09:20, Yang Yingliang wrote:
> From: Yang Yingliang <[email protected]>
>
> Add clk_disable_unprepare() in the error path in stm32_rng_init().
>
> Fixes: 6b85a7e141cb ("hwrng: stm32 - implement STM32MP13x support")
> Signed-off-by: Yang Yingliang <[email protected]>
> ---
> drivers/char/hw_random/stm32-rng.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/char/hw_random/stm32-rng.c b/drivers/char/hw_random/stm32-rng.c
> index 41e1dbea5d2e..efd6edcd7066 100644
> --- a/drivers/char/hw_random/stm32-rng.c
> +++ b/drivers/char/hw_random/stm32-rng.c
> @@ -325,6 +325,7 @@ static int stm32_rng_init(struct hwrng *rng)
> (!(reg & RNG_CR_CONDRST)),
> 10, 50000);
> if (err) {
> + clk_disable_unprepare(priv->clk);
> dev_err((struct device *)priv->rng.priv,
> "%s: timeout %x!\n", __func__, reg);
> return -EINVAL;

2023-12-08 04:34:47

by Herbert Xu

[permalink] [raw]
Subject: Re: [PATCH] hwrng: stm32 - add missing clk_disable_unprepare() in stm32_rng_init()

On Fri, Dec 01, 2023 at 04:20:48PM +0800, Yang Yingliang wrote:
> From: Yang Yingliang <[email protected]>
>
> Add clk_disable_unprepare() in the error path in stm32_rng_init().
>
> Fixes: 6b85a7e141cb ("hwrng: stm32 - implement STM32MP13x support")
> Signed-off-by: Yang Yingliang <[email protected]>
> ---
> drivers/char/hw_random/stm32-rng.c | 1 +
> 1 file changed, 1 insertion(+)

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