Skip to contentSkip to conversation

drm/exynos: free sg object if dma_map_sg is failed

PATCH New Inki Dae 1 participant 1 message Jan 11, 2013

Subsystems (3)
lore
Share & tools
lore

Inki Dae

author maintainer
#0 lore raw

PATCH 1/1 drm/exynos: free sg object if dma_map_sg is failed

This patch releases sgt's sg object allocated by sgt_alloc_table correctly.

When exynos_gem_map_dma_buf was called by dma_buf_map_attachmemt(), the sgt's sg object was allocated by sg_alloc_tale() so if dma_map_sg() is failed, the sg object should be released.

---
 drivers/gpu/drm/exynos/exynos_drm_dmabuf.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_dmabuf.c +1 -0
index 9df9771..693d4bc 100644
@@ -110,6 +110,7 @@ static struct sg_table *
 	nents = dma_map_sg(attach->dev, sgt->sgl, sgt->orig_nents, dir);
 	if (!nents) {
 		DRM_ERROR("failed to map sgl with iommu.\n");
+		sg_free_table(sgt);
 		sgt = ERR_PTR(-EIO);
 		goto err_unlock;
 	}
Signature · 1 line
1.7.4.1