linux-amlogic.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Neil Armstrong <narmstrong@baylibre.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Matt Mackall" <mpm@selenic.com>,
	"Herbert Xu" <herbert@gondor.apana.org.au>,
	"Kevin Hilman" <khilman@baylibre.com>
Cc: Jerome Brunet <jbrunet@baylibre.com>,
	Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
	linux-crypto@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-amlogic@lists.infradead.org, kernel@pengutronix.de
Subject: Re: [PATCH] hwrng: meson - Improve error handling for core clock
Date: Wed, 15 Sep 2021 10:13:54 +0200	[thread overview]
Message-ID: <07a4f824-5a80-7c0b-d8c9-82e89446bd87@baylibre.com> (raw)
In-Reply-To: <20210914142428.57099-1-u.kleine-koenig@pengutronix.de>

On 14/09/2021 16:24, Uwe Kleine-König wrote:
> -ENOENT (ie. "there is no clock") is fine to ignore for an optional
> clock, other values are not supposed to be ignored and should be
> escalated to the caller (e.g. -EPROBE_DEFER). Ignore -ENOENT by using
> devm_clk_get_optional().
> 
> While touching this code also add an error message for the fatal errors.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/char/hw_random/meson-rng.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/char/hw_random/meson-rng.c b/drivers/char/hw_random/meson-rng.c
> index e446236e81f2..9f3e2eb8011d 100644
> --- a/drivers/char/hw_random/meson-rng.c
> +++ b/drivers/char/hw_random/meson-rng.c
> @@ -54,9 +54,15 @@ static int meson_rng_probe(struct platform_device *pdev)
>  	if (IS_ERR(data->base))
>  		return PTR_ERR(data->base);
>  
> -	data->core_clk = devm_clk_get(dev, "core");
> -	if (IS_ERR(data->core_clk))
> -		data->core_clk = NULL;
> +	data->core_clk = devm_clk_get_optional(dev, "core");
> +	if (IS_ERR(data->core_clk)) {
> +		ret = PTR_ERR(data->core_clk);
> +		if (ret != -EPROBE_DEFER)
> +			dev_err(dev, "Failed to get core clock: %pe\n",
> +				data->core_clk);
> +
> +		return ret;
> +	}
>  
>  	if (data->core_clk) {
>  		ret = clk_prepare_enable(data->core_clk);
> 

Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>

Thanks,
Neil

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

  reply	other threads:[~2021-09-15  8:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-14 14:24 [PATCH] hwrng: meson - Improve error handling for core clock Uwe Kleine-König
2021-09-15  8:13 ` Neil Armstrong [this message]
2021-09-19 20:07 ` Martin Blumenstingl

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=07a4f824-5a80-7c0b-d8c9-82e89446bd87@baylibre.com \
    --to=narmstrong@baylibre.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=jbrunet@baylibre.com \
    --cc=kernel@pengutronix.de \
    --cc=khilman@baylibre.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=mpm@selenic.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).