All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] crypto: fix safexcel_hash warning PTR_ERR_OR_ZERO can be used
@ 2019-10-19  0:44 Tian Tao
  2019-10-21  8:29 ` Pascal Van Leeuwen
  0 siblings, 1 reply; 2+ messages in thread
From: Tian Tao @ 2019-10-19  0:44 UTC (permalink / raw)
  To: gilad, herbert, davem, linux-crypto; +Cc: linuxarm

fix below warning reported by coccicheck.
the below code is only in the crypto-dev tree currently.
drivers/crypto/inside-secure/safexcel_cipher.c:2527:1-3: WARNING:
PTR_ERR_OR_ZERO can be used.

Fixes: 38f21b4bab11 ("crypto: inside-secure - Added support for the AES XCBC ahash")

Signed-off-by: Tian Tao <tiantao6@huawei.com>
---
 drivers/crypto/inside-secure/safexcel_hash.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/crypto/inside-secure/safexcel_hash.c b/drivers/crypto/inside-secure/safexcel_hash.c
index 85c3a07..3c71151 100644
--- a/drivers/crypto/inside-secure/safexcel_hash.c
+++ b/drivers/crypto/inside-secure/safexcel_hash.c
@@ -2109,10 +2109,8 @@ 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)
-- 
2.7.4


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

* RE: [PATCH] crypto: fix safexcel_hash warning PTR_ERR_OR_ZERO can be used
  2019-10-19  0:44 [PATCH] crypto: fix safexcel_hash warning PTR_ERR_OR_ZERO can be used Tian Tao
@ 2019-10-21  8:29 ` Pascal Van Leeuwen
  0 siblings, 0 replies; 2+ messages in thread
From: Pascal Van Leeuwen @ 2019-10-21  8:29 UTC (permalink / raw)
  To: Tian Tao, gilad, herbert, davem, linux-crypto; +Cc: linuxarm

> -----Original Message-----
> From: linux-crypto-owner@vger.kernel.org <linux-crypto-owner@vger.kernel.org> On Behalf Of
> Tian Tao
> Sent: Saturday, October 19, 2019 2:45 AM
> To: gilad@benyossef.com; herbert@gondor.apana.org.au; davem@davemloft.net; linux-
> crypto@vger.kernel.org
> Cc: linuxarm@huawei.com
> Subject: [PATCH] crypto: fix safexcel_hash warning PTR_ERR_OR_ZERO can be used
> 
> fix below warning reported by coccicheck.
> the below code is only in the crypto-dev tree currently.
> drivers/crypto/inside-secure/safexcel_cipher.c:2527:1-3: WARNING:
> PTR_ERR_OR_ZERO can be used.
> 
> Fixes: 38f21b4bab11 ("crypto: inside-secure - Added support for the AES XCBC ahash")
> 
> Signed-off-by: Tian Tao <tiantao6@huawei.com>
> ---
>  drivers/crypto/inside-secure/safexcel_hash.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/crypto/inside-secure/safexcel_hash.c b/drivers/crypto/inside-
> secure/safexcel_hash.c
> index 85c3a07..3c71151 100644
> --- a/drivers/crypto/inside-secure/safexcel_hash.c
> +++ b/drivers/crypto/inside-secure/safexcel_hash.c
> @@ -2109,10 +2109,8 @@ 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);
>  }
Thanks for spotting, but a similar patch has already been applied.
So this patch is obsolete now.

> 
>  static void safexcel_xcbcmac_cra_exit(struct crypto_tfm *tfm)
> --
> 2.7.4


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

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

end of thread, other threads:[~2019-10-21  8:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-19  0:44 [PATCH] crypto: fix safexcel_hash warning PTR_ERR_OR_ZERO can be used Tian Tao
2019-10-21  8:29 ` Pascal Van Leeuwen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.