[-next] crypto: inside-secure: Use PTR_ERR_OR_ZERO() to simplify code
diff mbox series

Message ID 1574074436-32134-1-git-send-email-zhengbin13@huawei.com
State Accepted
Delegated to: Herbert Xu
Headers show
Series
  • [-next] crypto: inside-secure: Use PTR_ERR_OR_ZERO() to simplify code
Related show

Commit Message

Zheng Bin Nov. 18, 2019, 10:53 a.m. UTC
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 <hulkci@huawei.com>
Signed-off-by: zhengbin <zhengbin13@huawei.com>
---
 drivers/crypto/inside-secure/safexcel_cipher.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

--
2.7.4

Comments

Herbert Xu Dec. 11, 2019, 9:31 a.m. UTC | #1
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 <hulkci@huawei.com>
> Signed-off-by: zhengbin <zhengbin13@huawei.com>
> ---
>  drivers/crypto/inside-secure/safexcel_cipher.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)

Patch applied.  Thanks.

Patch
diff mbox series

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)