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>
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);