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

Commit cd1a77e3 authored by Stanimir Varbanov's avatar Stanimir Varbanov Committed by Mauro Carvalho Chehab
Browse files

media: venus: fix wrong size on dma_free



This change will fix an issue with dma_free size found with
DMA API debug enabled.

Signed-off-by: default avatarStanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Cc: <stable@vger.kernel.org>      # for v4.13 and up
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 6771fce5
Loading
Loading
Loading
Loading
+4 −8
Original line number Diff line number Diff line
@@ -344,7 +344,7 @@ static int venus_alloc(struct venus_hfi_device *hdev, struct mem_desc *desc,
	desc->attrs = DMA_ATTR_WRITE_COMBINE;
	desc->size = ALIGN(size, SZ_4K);

	desc->kva = dma_alloc_attrs(dev, size, &desc->da, GFP_KERNEL,
	desc->kva = dma_alloc_attrs(dev, desc->size, &desc->da, GFP_KERNEL,
				    desc->attrs);
	if (!desc->kva)
		return -ENOMEM;
@@ -710,10 +710,8 @@ static int venus_interface_queues_init(struct venus_hfi_device *hdev)
	if (ret)
		return ret;

	hdev->ifaceq_table.kva = desc.kva;
	hdev->ifaceq_table.da = desc.da;
	hdev->ifaceq_table.size = IFACEQ_TABLE_SIZE;
	offset = hdev->ifaceq_table.size;
	hdev->ifaceq_table = desc;
	offset = IFACEQ_TABLE_SIZE;

	for (i = 0; i < IFACEQ_NUM; i++) {
		queue = &hdev->queues[i];
@@ -755,9 +753,7 @@ static int venus_interface_queues_init(struct venus_hfi_device *hdev)
	if (ret) {
		hdev->sfr.da = 0;
	} else {
		hdev->sfr.da = desc.da;
		hdev->sfr.kva = desc.kva;
		hdev->sfr.size = ALIGNED_SFR_SIZE;
		hdev->sfr = desc;
		sfr = hdev->sfr.kva;
		sfr->buf_size = ALIGNED_SFR_SIZE;
	}