@@ -6283,8 +6283,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);
@@ -6300,7 +6300,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;