* [PATCH] hwrng: rockchip: propagate reset errors
@ 2026-08-30 13:36 Pengpeng Hou
2026-08-31 16:09 ` Nicolas Frattaroli
0 siblings, 1 reply; 2+ messages in thread
From: Pengpeng Hou @ 2026-08-30 13:36 UTC (permalink / raw)
To: Daniel Golle
Cc: Pengpeng Hou, Aurelien Jarno, Nicolas Frattaroli, Olivia Mackall,
Herbert Xu, Heiko Stuebner, Philipp Zabel, linux-crypto,
linux-arm-kernel, linux-rockchip, linux-kernel
rk_rng_probe() pulses the optional or required reset array before
registering
the hardware RNG, but discards errors from both reset operations.
Return reset failures before publishing the RNG device.
Fixes: 8eff8eb83fc0 ("hwrng: rockchip - add support for rk3588's standalone TRNG")
Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
---
drivers/char/hw_random/rockchip-rng.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/char/hw_random/rockchip-rng.c b/drivers/char/hw_random/rockchip-rng.c
index 6e3ed4b856051..ff98fcdc68911 100644
--- a/drivers/char/hw_random/rockchip-rng.c
+++ b/drivers/char/hw_random/rockchip-rng.c
@@ -412,9 +412,14 @@ static int rk_rng_probe(struct platform_device *pdev)
if (IS_ERR(rst))
return dev_err_probe(dev, PTR_ERR(rst), "Failed to get reset property\n");
- reset_control_assert(rst);
+ ret = reset_control_assert(rst);
+ if (ret)
+ return ret;
+
udelay(2);
- reset_control_deassert(rst);
+ ret = reset_control_deassert(rst);
+ if (ret)
+ return ret;
}
platform_set_drvdata(pdev, rk_rng);
base-commit: 08dbfad3f5040f5bdb6c529da20d6d4e81fefd72
--
2.50.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] hwrng: rockchip: propagate reset errors
2026-08-30 13:36 [PATCH] hwrng: rockchip: propagate reset errors Pengpeng Hou
@ 2026-08-31 16:09 ` Nicolas Frattaroli
0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Frattaroli @ 2026-08-31 16:09 UTC (permalink / raw)
To: Daniel Golle, Pengpeng Hou
Cc: Pengpeng Hou, Aurelien Jarno, Olivia Mackall, Herbert Xu,
Heiko Stuebner, Philipp Zabel, linux-crypto, linux-arm-kernel,
linux-rockchip, linux-kernel
On Sunday, 30 August 2026 15:36:52 Central European Summer Time Pengpeng Hou wrote:
> rk_rng_probe() pulses the optional or required reset array before
> registering
> the hardware RNG, but discards errors from both reset operations.
>
> Return reset failures before publishing the RNG device.
>
> Fixes: 8eff8eb83fc0 ("hwrng: rockchip - add support for rk3588's standalone TRNG")
> Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
> ---
> drivers/char/hw_random/rockchip-rng.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/char/hw_random/rockchip-rng.c b/drivers/char/hw_random/rockchip-rng.c
> index 6e3ed4b856051..ff98fcdc68911 100644
> --- a/drivers/char/hw_random/rockchip-rng.c
> +++ b/drivers/char/hw_random/rockchip-rng.c
> @@ -412,9 +412,14 @@ static int rk_rng_probe(struct platform_device *pdev)
> if (IS_ERR(rst))
> return dev_err_probe(dev, PTR_ERR(rst), "Failed to get reset property\n");
>
> - reset_control_assert(rst);
> + ret = reset_control_assert(rst);
> + if (ret)
> + return ret;
> +
> udelay(2);
> - reset_control_deassert(rst);
> + ret = reset_control_deassert(rst);
> + if (ret)
> + return ret;
> }
>
> platform_set_drvdata(pdev, rk_rng);
>
> base-commit: 08dbfad3f5040f5bdb6c529da20d6d4e81fefd72
>
The reset controller on rockchip SoCs does not return anything other
than 0 on the assert/deassert ops, and even if it did, the probe
function should use dev_err_probe to report those failures.
In other words, this patch only adds (non-ideal) dead code.
Kind regards,
Nicolas Frattaroli
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-31 16:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-30 13:36 [PATCH] hwrng: rockchip: propagate reset errors Pengpeng Hou
2026-08-31 16:09 ` Nicolas Frattaroli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox