]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
drm/exynos: return NULL if exynos_pages_to_sg fails
authorSubash Patel <subash.rp@samsung.com>
Mon, 25 Jun 2012 18:22:56 +0000 (11:22 -0700)
committerInki Dae <inki.dae@samsung.com>
Fri, 27 Jul 2012 02:13:55 +0000 (11:13 +0900)
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>
drivers/gpu/drm/exynos/exynos_drm_dmabuf.c

index 274909271c36de62e18d10b81fe01a58b598fc61..cb29e474da8e0e9c1e7f93e2fd6b8e480733bcca 100644 (file)
@@ -86,6 +86,10 @@ static struct sg_table *
        npages = buf->size / buf->page_size;
 
        sgt = exynos_pages_to_sg(buf->pages, npages, buf->page_size);
+       if (!sgt) {
+               DRM_DEBUG_PRIME("exynos_pages_to_sg returned NULL!\n");
+               goto err_unlock;
+       }
        nents = dma_map_sg(attach->dev, sgt->sgl, sgt->nents, dir);
 
        DRM_DEBUG_PRIME("npages = %d buffer size = 0x%lx page_size = 0x%lx\n",