[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <DB7PR08MB300375061ADC2E6A40C6CDDFE9550@DB7PR08MB3003.eurprd08.prod.outlook.com>
Date: Thu, 27 Aug 2020 14:11:32 +0000
From: Hadar Gat <Hadar.Gat@....com>
To: Krzysztof Kozlowski <krzk@...nel.org>,
Matt Mackall <mpm@...enic.com>,
Herbert Xu <herbert@...dor.apana.org.au>,
Arnd Bergmann <arnd@...db.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"linux-crypto@...r.kernel.org" <linux-crypto@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC: nd <nd@....com>
Subject: RE: [PATCH] hwrng: cctrn - Simplify with dev_err_probe()
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@...nel.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@....com>
Hadar
Powered by blists - more mailing lists