]> git.baikalelectronics.ru Git - kernel.git/commitdiff
crypto: hisilicon - fix a NULL vs IS_ERR() bug in sec_create_qp_ctx()
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 26 Nov 2019 12:21:20 +0000 (15:21 +0300)
committerHerbert Xu <herbert@gondor.apana.org.au>
Wed, 27 Nov 2019 05:08:50 +0000 (13:08 +0800)
The hisi_acc_create_sgl_pool() function returns error pointers, it never
returns NULL pointers.

Fixes: 29185717a874 ("crypto: hisilicon - add HiSilicon SEC V2 driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/hisilicon/sec2/sec_crypto.c

index dc1eb97d57f7011085ed85ec22618a528bf47bb5..62b04e19067c3cfb5fb1856ab15885f9e7197237 100644 (file)
@@ -179,14 +179,14 @@ static int sec_create_qp_ctx(struct hisi_qm *qm, struct sec_ctx *ctx,
 
        qp_ctx->c_in_pool = hisi_acc_create_sgl_pool(dev, QM_Q_DEPTH,
                                                     SEC_SGL_SGE_NR);
-       if (!qp_ctx->c_in_pool) {
+       if (IS_ERR(qp_ctx->c_in_pool)) {
                dev_err(dev, "fail to create sgl pool for input!\n");
                goto err_free_req_list;
        }
 
        qp_ctx->c_out_pool = hisi_acc_create_sgl_pool(dev, QM_Q_DEPTH,
                                                      SEC_SGL_SGE_NR);
-       if (!qp_ctx->c_out_pool) {
+       if (IS_ERR(qp_ctx->c_out_pool)) {
                dev_err(dev, "fail to create sgl pool for output!\n");
                goto err_free_c_in_pool;
        }