linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hadar Gat <Hadar.Gat@arm.com>
To: Krzysztof Kozlowski <krzk@kernel.org>,
	Matt Mackall <mpm@selenic.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: nd <nd@arm.com>
Subject: RE: [PATCH] hwrng: cctrn - Simplify with dev_err_probe()
Date: Thu, 27 Aug 2020 14:11:32 +0000	[thread overview]
Message-ID: <DB7PR08MB300375061ADC2E6A40C6CDDFE9550@DB7PR08MB3003.eurprd08.prod.outlook.com> (raw)
In-Reply-To: <20200826153233.27586-1-krzk@kernel.org>

Hi Krzysztof,

> Common pattern of handling deferred probe can be simplified with
> dev_err_probe().  Less code and also it prints the error value.
> 
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> ---
>  drivers/char/hw_random/cctrng.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/char/hw_random/cctrng.c
> b/drivers/char/hw_random/cctrng.c index 619148fb2dc9..7a293f2147a0
> 100644
> --- a/drivers/char/hw_random/cctrng.c
> +++ b/drivers/char/hw_random/cctrng.c
> @@ -463,11 +463,10 @@ static int cc_trng_clk_init(struct cctrng_drvdata
> *drvdata)
>  	int rc = 0;
> 
>  	clk = devm_clk_get_optional(dev, NULL);
> -	if (IS_ERR(clk)) {
> -		if (PTR_ERR(clk) != -EPROBE_DEFER)
> -			dev_err(dev, "Error getting clock: %pe\n", clk);
> -		return PTR_ERR(clk);
> -	}
> +	if (IS_ERR(clk))
> +		return dev_err_probe(dev, PTR_ERR(clk),
> +				     "Error getting clock\n");
> +
>  	drvdata->clk = clk;
> 
>  	rc = clk_prepare_enable(drvdata->clk);
> --
> 2.17.1

Thanks for this code simplification. :-)

Acked-by: Hadar Gat <hadar.gat@arm.com>

Hadar

  reply	other threads:[~2020-08-27 14:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-26 15:32 [PATCH] hwrng: cctrn - Simplify with dev_err_probe() Krzysztof Kozlowski
2020-08-27 14:11 ` Hadar Gat [this message]
2020-09-04  8:27 ` Herbert Xu

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=DB7PR08MB300375061ADC2E6A40C6CDDFE9550@DB7PR08MB3003.eurprd08.prod.outlook.com \
    --to=hadar.gat@arm.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=krzk@kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpm@selenic.com \
    --cc=nd@arm.com \
    /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).