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

Commit eba10dc9 authored by Jigarkumar Zala's avatar Jigarkumar Zala
Browse files

msm: camera: Fix buffer length size



Fix buffer length size assignment at the time of buffer allocation
and mapping.

Change-Id: I295d55f45fb7df4544ab285091388adc8bc0c10c
Signed-off-by: default avatarJigarkumar Zala <jzala@codeaurora.org>
parent 5f228f0a
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -185,6 +185,8 @@ int cam_mem_get_io_buf(int32_t buf_handle, int32_t mmu_handle,
{
	int rc = 0, idx;

	*len_ptr = 0;

	idx = CAM_MEM_MGR_GET_HDL_IDX(buf_handle);
	if (idx >= CAM_MEM_BUFQ_MAX || idx <= 0)
		return -EINVAL;
@@ -208,9 +210,16 @@ int cam_mem_get_io_buf(int32_t buf_handle, int32_t mmu_handle,
			tbl.bufq[idx].fd,
			iova_ptr,
			len_ptr);
	if (rc < 0)
		CAM_ERR(CAM_CRM, "fail to get buf hdl :%d", buf_handle);
	if (rc) {
		CAM_ERR(CAM_CRM,
			"fail to map buf_hdl:0x%x, mmu_hdl: 0x%x for fd:%d",
			buf_handle, mmu_handle, tbl.bufq[idx].fd);
		goto handle_mismatch;
	}

	CAM_DBG(CAM_CRM,
		"handle:0x%x fd:%d iova_ptr:%pK len_ptr:%llu",
		mmu_handle, tbl.bufq[idx].fd, iova_ptr, *len_ptr);
handle_mismatch:
	mutex_unlock(&tbl.bufq[idx].q_lock);
	return rc;
+1 −1
Original line number Diff line number Diff line
@@ -1475,7 +1475,7 @@ static int cam_smmu_map_buffer_validate(struct dma_buf *buf,
		}

		*paddr_ptr = sg_dma_address(table->sgl);
		*len_ptr = (size_t)sg_dma_len(table->sgl);
		*len_ptr = (size_t)buf->size;
	} else {
		CAM_ERR(CAM_SMMU, "Error: Wrong region id passed");
		rc = -EINVAL;