Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c5f31717 authored by E V Ravi's avatar E V Ravi Committed by Gerrit - the friendly Code Review server
Browse files

msm: ais: mem: Validate return value of dma_buf_get



After ion allocation dma_buf_get called to increase the ref count.
Validation is required to know the dma_buf_get success or not.

Change-Id: I86724a17583ca29b509434065477b3aec421ada3
Signed-off-by: default avatarE V Ravi <evenka@codeaurora.org>
parent b8cd1590
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -433,6 +433,7 @@ static int cam_mem_util_get_dma_buf_fd(size_t len,
	struct dma_buf **buf,
	int *fd)
{
	struct dma_buf *dmabuf = NULL;
	int rc = 0;

	if (!buf || !fd) {
@@ -456,7 +457,11 @@ static int cam_mem_util_get_dma_buf_fd(size_t len,
	 * when we close fd, refcount becomes 1 and when we do
	 * dmap_put_buf, ref count becomes 0 and memory will be freed.
	 */
	dma_buf_get(*fd);
	dmabuf = dma_buf_get(*fd);
	if (IS_ERR_OR_NULL(dmabuf)) {
		CAM_ERR(CAM_MEM, "dma_buf_get failed, *fd=%d", *fd);
		rc = -EINVAL;
	}

	return rc;