[PATCH] crypto: fix safexcel_hash warning PTR_ERR_OR_ZERO can be used

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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




[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux