Commit 33b53749 authored by Yang Yingliang's avatar Yang Yingliang Committed by Herbert Xu

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: e22471c2 ("crypto: starfive - Add AES skcipher and aead support")
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent b9a281f1
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment