Re: [Linaro-mm-sig] [PATCH] DRM: exynos: return NULL if exynos_pages_to_sg fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Subash,

Could you re-post this patch seperately? your patch includes another one.

Thanks,
Inki Dae

2012/6/23 Subash Patel <subashrp@xxxxxxxxx>:
> From: Subash Patel <subash.rp@xxxxxxxxxxx>
>
> 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@xxxxxxxxxx>
> CC: dri-devel@xxxxxxxxxxxxxxxxxxxxx
> CC: linux-samsung-soc@xxxxxxxxxxxxxxx
> CC: linaro-mm-sig@xxxxxxxxxxxxxxxx
> CC: inki.dae@xxxxxxxxxxx
> CC: airlied@xxxxxxxxxx
> CC: olofj@xxxxxxxxxxxx
> ---
>  drivers/gpu/drm/exynos/exynos_drm_dmabuf.c |    6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c b/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c
> index 97325c1..c908a29 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c
> @@ -87,6 +87,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",
> @@ -241,7 +245,7 @@ struct drm_gem_object *exynos_dmabuf_prime_import(struct drm_device *drm_dev,
>
>
>        sgt = dma_buf_map_attachment(attach, DMA_BIDIRECTIONAL);
> -       if (IS_ERR(sgt)) {
> +       if (IS_ERR_OR_NULL(sgt)) {
>                ret = PTR_ERR(sgt);
>                goto err_buf_detach;
>        }
> --
> 1.7.9.5
>
>
> _______________________________________________
> Linaro-mm-sig mailing list
> Linaro-mm-sig@xxxxxxxxxxxxxxxx
> http://lists.linaro.org/mailman/listinfo/linaro-mm-sig
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SoC Development]     [Linux Rockchip Development]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Linux SCSI]     [Yosemite News]

  Powered by Linux