2019-10-09 12:07:48

by Yue Haibing

[permalink] [raw]
Subject: [PATCH -next] crypto: Use PTR_ERR_OR_ZERO in safexcel_xcbcmac_cra_init()

Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Signed-off-by: YueHaibing <[email protected]>
---
drivers/crypto/inside-secure/safexcel_hash.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/crypto/inside-secure/safexcel_hash.c b/drivers/crypto/inside-secure/safexcel_hash.c
index 85c3a075f283..a07a2915fab1 100644
--- a/drivers/crypto/inside-secure/safexcel_hash.c
+++ b/drivers/crypto/inside-secure/safexcel_hash.c
@@ -2109,10 +2109,7 @@ static int safexcel_xcbcmac_cra_init(struct crypto_tfm *tfm)

safexcel_ahash_cra_init(tfm);
ctx->kaes = crypto_alloc_cipher("aes", 0, 0);
- if (IS_ERR(ctx->kaes))
- return PTR_ERR(ctx->kaes);
-
- return 0;
+ return PTR_ERR_OR_ZERO(ctx->kaes);
}

static void safexcel_xcbcmac_cra_exit(struct crypto_tfm *tfm)






2019-10-09 12:14:29

by Antoine Tenart

[permalink] [raw]
Subject: Re: [PATCH -next] crypto: Use PTR_ERR_OR_ZERO in safexcel_xcbcmac_cra_init()

On Wed, Oct 09, 2019 at 12:06:21PM +0000, YueHaibing wrote:
> Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
>
> Signed-off-by: YueHaibing <[email protected]>

Acked-by: Antoine Tenart <[email protected]>

Thanks,
Antoine

> ---
> drivers/crypto/inside-secure/safexcel_hash.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/crypto/inside-secure/safexcel_hash.c b/drivers/crypto/inside-secure/safexcel_hash.c
> index 85c3a075f283..a07a2915fab1 100644
> --- a/drivers/crypto/inside-secure/safexcel_hash.c
> +++ b/drivers/crypto/inside-secure/safexcel_hash.c
> @@ -2109,10 +2109,7 @@ static int safexcel_xcbcmac_cra_init(struct crypto_tfm *tfm)
>
> safexcel_ahash_cra_init(tfm);
> ctx->kaes = crypto_alloc_cipher("aes", 0, 0);
> - if (IS_ERR(ctx->kaes))
> - return PTR_ERR(ctx->kaes);
> -
> - return 0;
> + return PTR_ERR_OR_ZERO(ctx->kaes);
> }
>
> static void safexcel_xcbcmac_cra_exit(struct crypto_tfm *tfm)
>
>
>
>
>

--
Antoine T?nart, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

2019-10-09 13:30:34

by Pascal Van Leeuwen

[permalink] [raw]
Subject: RE: [PATCH -next] crypto: Use PTR_ERR_OR_ZERO in safexcel_xcbcmac_cra_init()

> -----Original Message-----
> From: [email protected] <[email protected]> On Behalf Of
> YueHaibing
> Sent: Wednesday, October 9, 2019 2:06 PM
> To: Antoine Tenart <[email protected]>; Herbert Xu <[email protected]>
> Cc: YueHaibing <[email protected]>; [email protected]; kernel-
> [email protected]
> Subject: [PATCH -next] crypto: Use PTR_ERR_OR_ZERO in safexcel_xcbcmac_cra_init()
>
> Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
>
> Signed-off-by: YueHaibing <[email protected]>
>
Acked-by: Pascal van Leeuwen <[email protected]>

> ---
> drivers/crypto/inside-secure/safexcel_hash.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/crypto/inside-secure/safexcel_hash.c b/drivers/crypto/inside-
> secure/safexcel_hash.c
> index 85c3a075f283..a07a2915fab1 100644
> --- a/drivers/crypto/inside-secure/safexcel_hash.c
> +++ b/drivers/crypto/inside-secure/safexcel_hash.c
> @@ -2109,10 +2109,7 @@ static int safexcel_xcbcmac_cra_init(struct crypto_tfm *tfm)
>
> safexcel_ahash_cra_init(tfm);
> ctx->kaes = crypto_alloc_cipher("aes", 0, 0);
> - if (IS_ERR(ctx->kaes))
> - return PTR_ERR(ctx->kaes);
> -
> - return 0;
> + return PTR_ERR_OR_ZERO(ctx->kaes);
>
Ah cool, you can do that in one go, didn't know that yet :-) Thanks!

> }
>
> static void safexcel_xcbcmac_cra_exit(struct crypto_tfm *tfm)
>
>
>
>

Regards,
Pascal van Leeuwen
Silicon IP Architect, Multi-Protocol Engines @ Verimatrix
http://www.insidesecure.com

2019-10-19 07:55:30

by Herbert Xu

[permalink] [raw]
Subject: Re: [PATCH -next] crypto: Use PTR_ERR_OR_ZERO in safexcel_xcbcmac_cra_init()

On Wed, Oct 09, 2019 at 12:06:21PM +0000, YueHaibing wrote:
> Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
>
> Signed-off-by: YueHaibing <[email protected]>
> ---
> drivers/crypto/inside-secure/safexcel_hash.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)

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