Commit 8b5a3c17 authored by Thierry Reding's avatar Thierry Reding
Browse files

drm/tegra: gem: Always map SG tables for DMA-BUFs



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: default avatarThierry Reding <treding@nvidia.com>
parent d81f3431
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -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: