From: Inki Dae Date: Fri, 11 Jan 2013 04:38:28 +0000 (+0900) Subject: drm/exynos: free sg object if dma_map_sg is failed X-Git-Tag: firefly_0821_release~3680^2~1188^2~1^2~10 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=420ae1e2623af92e71437e403fd11de48e11551f;p=firefly-linux-kernel-4.4.55.git 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. Signed-off-by: Inki Dae Signed-off-by: Kyungmin Park --- diff --git a/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c b/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c index 9df97714b6c0..693d4bca1518 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c @@ -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; }