diff mbox series

crypto: Fix return value check in aead_crypt()

Message ID 1604653287-16577-1-git-send-email-wangqing@vivo.com
State New
Headers show
Series crypto: Fix return value check in aead_crypt() | expand

Commit Message

Qing Wang Nov. 6, 2020, 9:01 a.m. UTC
Fix passing zero to 'PTR_ERR' warning

Signed-off-by: Wang Qing <wangqing@vivo.com>
---
 drivers/crypto/caam/caamalg_qi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Herbert Xu Nov. 20, 2020, 6:56 a.m. UTC | #1
On Thu, Nov 12, 2020 at 11:21:46AM +0200, Horia Geantă wrote:
> 

> Wang Qing reports that IS_ERR_OR_NULL() should be matched with

> PTR_ERR_OR_ZERO(), not PTR_ERR().

> 

> As it turns out, the error path always returns an error code,

> i.e. NULL is never returned.

> Update the code accordingly - s/IS_ERR_OR_NULL/IS_ERR.

> 

> Reported-by: Wang Qing <wangqing@vivo.com>

> Signed-off-by: Horia Geantă <horia.geanta@nxp.com>

> ---

>  drivers/crypto/caam/caamalg_qi.c | 8 ++++----

>  1 file changed, 4 insertions(+), 4 deletions(-)


Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
diff mbox series

Patch

diff --git a/drivers/crypto/caam/caamalg_qi.c b/drivers/crypto/caam/caamalg_qi.c
index 66f60d7..add60e8
--- a/drivers/crypto/caam/caamalg_qi.c
+++ b/drivers/crypto/caam/caamalg_qi.c
@@ -1166,7 +1166,7 @@  static inline int aead_crypt(struct aead_request *req, bool encrypt)
 	/* allocate extended descriptor */
 	edesc = aead_edesc_alloc(req, encrypt);
 	if (IS_ERR_OR_NULL(edesc))
-		return PTR_ERR(edesc);
+		return PTR_ERR_OR_ZERO(edesc);
 
 	/* Create and submit job descriptor */
 	ret = caam_qi_enqueue(ctx->qidev, &edesc->drv_req);