]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm/tegra: gem: Always map SG tables for DMA-BUFs
authorThierry Reding <treding@nvidia.com>
Fri, 8 Jun 2018 12:59:13 +0000 (14:59 +0200)
committerThierry Reding <treding@nvidia.com>
Mon, 28 Oct 2019 10:18:40 +0000 (11:18 +0100)
When an importer wants to map a DMA-BUF, make sure to always actually
map it, irrespective of whether the buffer is contiguous or not.

Signed-off-by: Thierry Reding <treding@nvidia.com>
drivers/gpu/drm/tegra/gem.c

index 3345cce14662a924f4e41adbdd95537e857fc6a3..00701cadaceb93b62962a3c7882d1a48e4156426 100644 (file)
@@ -516,15 +516,15 @@ tegra_gem_prime_map_dma_buf(struct dma_buf_attachment *attach,
 
                for_each_sg(sgt->sgl, sg, bo->num_pages, i)
                        sg_set_page(sg, bo->pages[i], PAGE_SIZE, 0);
-
-               if (dma_map_sg(attach->dev, sgt->sgl, sgt->nents, dir) == 0)
-                       goto free;
        } else {
                if (dma_get_sgtable(attach->dev, sgt, bo->vaddr, bo->iova,
                                    gem->size) < 0)
                        goto free;
        }
 
+       if (dma_map_sg(attach->dev, sgt->sgl, sgt->nents, dir) == 0)
+               goto free;
+
        return sgt;
 
 free: