summaryrefslogtreecommitdiff
path: root/drivers/crypto/hisilicon/qm.c
diff options
context:
space:
mode:
authorWeili Qian <qianweili@huawei.com>2022-08-13 13:34:52 +0300
committerHerbert Xu <herbert@gondor.apana.org.au>2022-08-19 13:39:38 +0300
commit116be08f6e4e385733d42360a33c3d883d2dd702 (patch)
tree71c73cdf2080affc810f2f67233f41fa0f233aa4 /drivers/crypto/hisilicon/qm.c
parent582b05bba481d5798ef884f1396285ab47e426e1 (diff)
downloadlinux-116be08f6e4e385733d42360a33c3d883d2dd702.tar.xz
crypto: hisilicon/qm - fix missing destroy qp_idr
In the function hisi_qm_memory_init(), if resource alloc fails after idr_init, the initialized qp_idr needs to be destroyed. Signed-off-by: Weili Qian <qianweili@huawei.com> Signed-off-by: Yang Shen <shenyang39@huawei.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/hisilicon/qm.c')
-rw-r--r--drivers/crypto/hisilicon/qm.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c
index 9701434a8ef3..728dcee0b1ff 100644
--- a/drivers/crypto/hisilicon/qm.c
+++ b/drivers/crypto/hisilicon/qm.c
@@ -6139,8 +6139,8 @@ static int hisi_qm_memory_init(struct hisi_qm *qm)
GFP_ATOMIC);
dev_dbg(dev, "allocate qm dma buf size=%zx)\n", qm->qdma.size);
if (!qm->qdma.va) {
- ret = -ENOMEM;
- goto err_alloc_qdma;
+ ret = -ENOMEM;
+ goto err_destroy_idr;
}
QM_INIT_BUF(qm, eqe, QM_EQ_DEPTH);
@@ -6156,7 +6156,8 @@ static int hisi_qm_memory_init(struct hisi_qm *qm)
err_alloc_qp_array:
dma_free_coherent(dev, qm->qdma.size, qm->qdma.va, qm->qdma.dma);
-err_alloc_qdma:
+err_destroy_idr:
+ idr_destroy(&qm->qp_idr);
kfree(qm->factor);
return ret;