From: Yang Yingliang Date: Mon, 31 Jul 2023 14:02:49 +0000 (+0800) Subject: crypto: starfive - fix return value check in starfive_aes_prepare_req() X-Git-Tag: v6.6.7~2012^2~65 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=33b53749aa1f9fb0f5aa0ac37269944a080b982f;p=platform%2Fkernel%2Flinux-starfive.git crypto: starfive - fix return value check in starfive_aes_prepare_req() kzalloc() returns NULL pointer not PTR_ERR() when it fails, so replace the IS_ERR() check with NULL pointer check. Fixes: e22471c2331c ("crypto: starfive - Add AES skcipher and aead support") Signed-off-by: Yang Yingliang Signed-off-by: Herbert Xu --- diff --git a/drivers/crypto/starfive/jh7110-aes.c b/drivers/crypto/starfive/jh7110-aes.c index 04dd795..278dfa4 100644 --- a/drivers/crypto/starfive/jh7110-aes.c +++ b/drivers/crypto/starfive/jh7110-aes.c @@ -496,8 +496,8 @@ static int starfive_aes_prepare_req(struct skcipher_request *req, if (cryp->assoclen) { rctx->adata = kzalloc(ALIGN(cryp->assoclen, AES_BLOCK_SIZE), GFP_KERNEL); - if (IS_ERR(rctx->adata)) - return dev_err_probe(cryp->dev, PTR_ERR(rctx->adata), + if (!rctx->adata) + return dev_err_probe(cryp->dev, -ENOMEM, "Failed to alloc memory for adata"); scatterwalk_copychunks(rctx->adata, &cryp->in_walk, cryp->assoclen, 0);