drm/exynos: free sg object if dma_map_sg is failed
authorInki Dae <inki.dae@samsung.com>
Fri, 11 Jan 2013 04:38:28 +0000 (13:38 +0900)
committerInki Dae <inki.dae@samsung.com>
Fri, 25 Jan 2013 05:38:44 +0000 (14:38 +0900)
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.

Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
drivers/gpu/drm/exynos/exynos_drm_dmabuf.c

index 9df97714b6c0b8a2244fa1f61da5eb4a76c774dd..693d4bca15186d6b740159a07140aacdf2e4e64d 100644 (file)
@@ -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;
        }