Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
To: Daniel Golle <daniel@makrotopia.org>,
	Pengpeng Hou <pengpeng@iscas.ac.cn>
Cc: Pengpeng Hou <pengpeng@iscas.ac.cn>,
	Aurelien Jarno <aurelien@aurel32.net>,
	Olivia Mackall <olivia@selenic.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	Heiko Stuebner <heiko@sntech.de>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	linux-crypto@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] hwrng: rockchip: propagate reset errors
Date: Mon, 31 Aug 2026 18:09:22 +0200	[thread overview]
Message-ID: <g-bFxA6aS-CpTGGZJIq8QQ@collabora.com> (raw)
In-Reply-To: <20260830133652.7618-1-pengpeng@iscas.ac.cn>

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




      reply	other threads:[~2026-08-31 16:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-30 13:36 [PATCH] hwrng: rockchip: propagate reset errors Pengpeng Hou
2026-08-31 16:09 ` Nicolas Frattaroli [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=g-bFxA6aS-CpTGGZJIq8QQ@collabora.com \
    --to=nicolas.frattaroli@collabora.com \
    --cc=aurelien@aurel32.net \
    --cc=daniel@makrotopia.org \
    --cc=heiko@sntech.de \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=olivia@selenic.com \
    --cc=p.zabel@pengutronix.de \
    --cc=pengpeng@iscas.ac.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox