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: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: <stable@vger.kernel.org>      # for v4.13 and up
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
This commit is contained in:
Stanimir Varbanov 2017-10-09 14:24:57 +02:00 committed by Mauro Carvalho Chehab
parent 6771fce506
commit cd1a77e3c9

View File

@ -344,7 +344,7 @@ static int venus_alloc(struct venus_hfi_device *hdev, struct mem_desc *desc,
desc->attrs = DMA_ATTR_WRITE_COMBINE; desc->attrs = DMA_ATTR_WRITE_COMBINE;
desc->size = ALIGN(size, SZ_4K); 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); desc->attrs);
if (!desc->kva) if (!desc->kva)
return -ENOMEM; return -ENOMEM;
@ -710,10 +710,8 @@ static int venus_interface_queues_init(struct venus_hfi_device *hdev)
if (ret) if (ret)
return ret; return ret;
hdev->ifaceq_table.kva = desc.kva; hdev->ifaceq_table = desc;
hdev->ifaceq_table.da = desc.da; offset = IFACEQ_TABLE_SIZE;
hdev->ifaceq_table.size = IFACEQ_TABLE_SIZE;
offset = hdev->ifaceq_table.size;
for (i = 0; i < IFACEQ_NUM; i++) { for (i = 0; i < IFACEQ_NUM; i++) {
queue = &hdev->queues[i]; queue = &hdev->queues[i];
@ -755,9 +753,7 @@ static int venus_interface_queues_init(struct venus_hfi_device *hdev)
if (ret) { if (ret) {
hdev->sfr.da = 0; hdev->sfr.da = 0;
} else { } else {
hdev->sfr.da = desc.da; hdev->sfr = desc;
hdev->sfr.kva = desc.kva;
hdev->sfr.size = ALIGNED_SFR_SIZE;
sfr = hdev->sfr.kva; sfr = hdev->sfr.kva;
sfr->buf_size = ALIGNED_SFR_SIZE; sfr->buf_size = ALIGNED_SFR_SIZE;
} }