msm: cvp: Avoids DSP memory leak

Call dma_buf put function to decrement dma_buf use count after
the buffer is un-mapped from CVP address space.

Change-Id: I3007ff8fc55796ae21ee3995ff3456a6e207f804
Signed-off-by: George Shen <sqiao@codeaurora.org>
This commit is contained in:
George Shen 2020-05-19 16:15:07 -07:00
commit 021b9bfe46

View file

@ -163,8 +163,10 @@ int msm_cvp_map_buf_dsp(struct msm_cvp_inst *inst, struct cvp_kmd_buffer *buf)
return rc;
exit:
if (smem->device_addr)
if (smem->device_addr) {
msm_cvp_unmap_smem(inst, smem, "unmap dsp");
msm_cvp_smem_put_dma_buf(smem->dma_buf);
}
kmem_cache_free(cvp_driver->buf_cache, cbuf);
cbuf = NULL;
kmem_cache_free(cvp_driver->smem_cache, smem);
@ -216,8 +218,10 @@ int msm_cvp_unmap_buf_dsp(struct msm_cvp_inst *inst, struct cvp_kmd_buffer *buf)
}
}
if (cbuf->smem->device_addr)
if (cbuf->smem->device_addr) {
msm_cvp_unmap_smem(inst, cbuf->smem, "unmap dsp");
msm_cvp_smem_put_dma_buf(cbuf->smem->dma_buf);
}
mutex_lock(&inst->cvpdspbufs.lock);
list_del(&cbuf->list);