aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorSubash Patel <subash.rp@samsung.com>2012-06-25 14:22:56 -0400
committerInki Dae <inki.dae@samsung.com>2012-07-26 22:13:55 -0400
commit56fb5380c76d75d30b0e7acdfd36de34b4ee4375 (patch)
treea54ebe3160e8f13f6eabed44abe00d363a60ad06 /drivers/gpu
parent9416dfa76ab418a2ba71ec1027f3c0af674d6e23 (diff)
drm/exynos: return NULL if exynos_pages_to_sg fails
exynos_pages_to_sg() internally calls sg_kmalloc() which can return no pages when the system is under high memory crunch. One such instance is chromeos-install in the chromeos. This patch adds check for the return value of the function in subject to return NULL on failure. Signed-off-by: Subash Patel <subash.ramaswamy@linaro.org> Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_dmabuf.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c b/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c
index 274909271c36..cb29e474da8e 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c
@@ -86,6 +86,10 @@ static struct sg_table *
86 npages = buf->size / buf->page_size; 86 npages = buf->size / buf->page_size;
87 87
88 sgt = exynos_pages_to_sg(buf->pages, npages, buf->page_size); 88 sgt = exynos_pages_to_sg(buf->pages, npages, buf->page_size);
89 if (!sgt) {
90 DRM_DEBUG_PRIME("exynos_pages_to_sg returned NULL!\n");
91 goto err_unlock;
92 }
89 nents = dma_map_sg(attach->dev, sgt->sgl, sgt->nents, dir); 93 nents = dma_map_sg(attach->dev, sgt->sgl, sgt->nents, dir);
90 94
91 DRM_DEBUG_PRIME("npages = %d buffer size = 0x%lx page_size = 0x%lx\n", 95 DRM_DEBUG_PRIME("npages = %d buffer size = 0x%lx page_size = 0x%lx\n",