[PATCH] crypto: fix ptr_ret.cocci warnings

From: kbuild test robot
Date: Thu Oct 10 2019 - 11:02:47 EST


From: kbuild test robot <lkp@xxxxxxxxx>

drivers/crypto/inside-secure/safexcel_hash.c:2081:1-3: WARNING: PTR_ERR_OR_ZERO can be used


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

Generated by: scripts/coccinelle/api/ptr_ret.cocci

Fixes: 38f21b4bab11 ("crypto: inside-secure - Added support for the AES XCBC ahash")
CC: Pascal van Leeuwen <pascalvanl@xxxxxxxxx>
Signed-off-by: kbuild test robot <lkp@xxxxxxxxx>
---

tree: https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
head: 504582e8e40b90b8f8c58783e2d1e4f6a2b71a3a
commit: 38f21b4bab11fc877ff18dd02f77f2c34f1105b9 [3/78] crypto: inside-secure - Added support for the AES XCBC ahash

safexcel_hash.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

--- a/drivers/crypto/inside-secure/safexcel_hash.c
+++ b/drivers/crypto/inside-secure/safexcel_hash.c
@@ -2078,10 +2078,7 @@ static int safexcel_xcbcmac_cra_init(str

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)