diff options
author | Yang Yingliang <yangyingliang@huawei.com> | 2023-07-31 22:02:49 +0800 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2023-08-11 19:19:27 +0800 |
commit | 33b53749aa1f9fb0f5aa0ac37269944a080b982f (patch) | |
tree | 14a44a63d86c93a4987f7f705c2a1c1d34568f2b /drivers/crypto/starfive | |
parent | b9a281f1f72b9786a4cb04b4105c121f3333aabf (diff) |
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 <yangyingliang@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/starfive')
-rw-r--r-- | drivers/crypto/starfive/jh7110-aes.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/crypto/starfive/jh7110-aes.c b/drivers/crypto/starfive/jh7110-aes.c index 04dd7958054f..278dfa4aa743 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); |