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

From: kbuild test robot
Date: Thu Oct 10 2019 - 10:30:42 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 8a8c600de5dc1d9a7f4b83269fddc80ebd3dd045
commit: 3e450886ec573cb9d7cb1758317b5e4e0f308b52 crypto: inside-secure - Added support for basic AES-GCM
date: 5 weeks ago

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>


coccinelle warnings: (new ones prefixed by >>)

>> drivers/crypto/inside-secure/safexcel_cipher.c:2001:1-3: WARNING: PTR_ERR_OR_ZERO can be used

vim +2001 drivers/crypto/inside-secure/safexcel_cipher.c

1989
1990 static int safexcel_aead_gcm_cra_init(struct crypto_tfm *tfm)
1991 {
1992 struct safexcel_cipher_ctx *ctx = crypto_tfm_ctx(tfm);
1993
1994 safexcel_aead_cra_init(tfm);
1995 ctx->hash_alg = CONTEXT_CONTROL_CRYPTO_ALG_GHASH;
1996 ctx->state_sz = GHASH_BLOCK_SIZE;
1997 ctx->xcm = 1; /* GCM */
1998 ctx->mode = CONTEXT_CONTROL_CRYPTO_MODE_XCM; /* override default */
1999
2000 ctx->hkaes = crypto_alloc_cipher("aes", 0, 0);
> 2001 if (IS_ERR(ctx->hkaes))
2002 return PTR_ERR(ctx->hkaes);
2003
2004 return 0;
2005 }
2006

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation