2019-11-18 10:47:22

by Zheng Bin

[permalink] [raw]
Subject: [PATCH -next] crypto: inside-secure: Use PTR_ERR_OR_ZERO() to simplify code

Fixes coccicheck warning:

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

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

diff --git a/drivers/crypto/inside-secure/safexcel_cipher.c b/drivers/crypto/inside-secure/safexcel_cipher.c
index c029956..08cb495 100644
--- a/drivers/crypto/inside-secure/safexcel_cipher.c
+++ b/drivers/crypto/inside-secure/safexcel_cipher.c
@@ -2532,10 +2532,7 @@ static int safexcel_aead_gcm_cra_init(struct crypto_tfm *tfm)
ctx->mode = CONTEXT_CONTROL_CRYPTO_MODE_XCM; /* override default */

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

static void safexcel_aead_gcm_cra_exit(struct crypto_tfm *tfm)
--
2.7.4


2019-12-11 09:31:49

by Herbert Xu

[permalink] [raw]
Subject: Re: [PATCH -next] crypto: inside-secure: Use PTR_ERR_OR_ZERO() to simplify code

On Mon, Nov 18, 2019 at 06:53:56PM +0800, zhengbin wrote:
> Fixes coccicheck warning:
>
> drivers/crypto/inside-secure/safexcel_cipher.c:2534:1-3: WARNING: PTR_ERR_OR_ZERO can be used
>
> Reported-by: Hulk Robot <[email protected]>
> Signed-off-by: zhengbin <[email protected]>
> ---
> drivers/crypto/inside-secure/safexcel_cipher.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