[PATCH 5/5] crypto: hisilicon - fix error handle in hisi_zip_create_req_q

From: Zhou Wang
Date: Wed Aug 14 2019 - 05:31:10 EST


Directly return error in the first loop in hisi_zip_create_req_q.

Fixes: 62c455ca853e ("crypto: hisilicon - add HiSilicon ZIP accelerator support")
Signed-off-by: Zhou Wang <wangzhou1@xxxxxxxxxxxxx>
---
drivers/crypto/hisilicon/zip/zip_crypto.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/hisilicon/zip/zip_crypto.c b/drivers/crypto/hisilicon/zip/zip_crypto.c
index 3033513..5a3f84d 100644
--- a/drivers/crypto/hisilicon/zip/zip_crypto.c
+++ b/drivers/crypto/hisilicon/zip/zip_crypto.c
@@ -223,8 +223,10 @@ static int hisi_zip_create_req_q(struct hisi_zip_ctx *ctx)
sizeof(long), GFP_KERNEL);
if (!req_q->req_bitmap) {
ret = -ENOMEM;
- if (i == 1)
- goto err_free_loop0;
+ if (i == 0)
+ return ret;
+
+ goto err_free_loop0;
}
rwlock_init(&req_q->req_lock);

--
2.8.1