media: venus: fix wrong size on dma_free
authorStanimir Varbanov <stanimir.varbanov@linaro.org>
Mon, 9 Oct 2017 12:24:57 +0000 (14:24 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 Nov 2017 08:40:58 +0000 (08:40 +0000)
commit cd1a77e3c9cc6dbb57f02aa50e1740fc144d2dad upstream.

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>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/media/platform/qcom/venus/hfi_venus.c

index 1caae8feaa36bb192daa31009d5306d40dc75f1f..734ce11b0ed0e20b2c8ef83bf3adff94b1106c56 100644 (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->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;
        }