linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hwrng: cctrn - Simplify with dev_err_probe()
@ 2020-08-26 15:32 Krzysztof Kozlowski
  2020-08-27 14:11 ` Hadar Gat
  2020-09-04  8:27 ` Herbert Xu
  0 siblings, 2 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-26 15:32 UTC (permalink / raw)
  To: Hadar Gat, Matt Mackall, Herbert Xu, Arnd Bergmann,
	Greg Kroah-Hartman, linux-crypto, linux-kernel
  Cc: Krzysztof Kozlowski

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH] hwrng: cctrn - Simplify with dev_err_probe()
  2020-08-26 15:32 [PATCH] hwrng: cctrn - Simplify with dev_err_probe() Krzysztof Kozlowski
@ 2020-08-27 14:11 ` Hadar Gat
  2020-09-04  8:27 ` Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Hadar Gat @ 2020-08-27 14:11 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Matt Mackall, Herbert Xu, Arnd Bergmann,
	Greg Kroah-Hartman, linux-crypto, linux-kernel
  Cc: nd

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] hwrng: cctrn - Simplify with dev_err_probe()
  2020-08-26 15:32 [PATCH] hwrng: cctrn - Simplify with dev_err_probe() Krzysztof Kozlowski
  2020-08-27 14:11 ` Hadar Gat
@ 2020-09-04  8:27 ` Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2020-09-04  8:27 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Hadar Gat, Matt Mackall, Arnd Bergmann, Greg Kroah-Hartman,
	linux-crypto, linux-kernel

On Wed, Aug 26, 2020 at 05:32:33PM +0200, Krzysztof Kozlowski wrote:
> 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(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-04  8:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-26 15:32 [PATCH] hwrng: cctrn - Simplify with dev_err_probe() Krzysztof Kozlowski
2020-08-27 14:11 ` Hadar Gat
2020-09-04  8:27 ` Herbert Xu

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).