From: Haixia Shi Date: Tue, 25 Nov 2014 20:04:03 +0000 (-0800) Subject: drm/udl: properly check for error pointers X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e38648f95d197b2296dec4b8c1f9a163c362f31e;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git drm/udl: properly check for error pointers The drm_prime_pages_to_sg() function never returns NULL pointers, only error pointers and valid pointers. Signed-off-by: Haixia Shi Reviewed-by: Stéphane Marchesin Signed-off-by: Dave Airlie --- diff --git a/drivers/gpu/drm/udl/udl_dmabuf.c b/drivers/gpu/drm/udl/udl_dmabuf.c index 2425b76dc44c..ac8a66b4dfc2 100644 --- a/drivers/gpu/drm/udl/udl_dmabuf.c +++ b/drivers/gpu/drm/udl/udl_dmabuf.c @@ -99,9 +99,9 @@ static struct sg_table *udl_map_dma_buf(struct dma_buf_attachment *attach, page_count = obj->base.size / PAGE_SIZE; obj->sg = drm_prime_pages_to_sg(obj->pages, page_count); - if (!obj->sg) { - DRM_ERROR("sg is null.\n"); - return ERR_PTR(-ENOMEM); + if (IS_ERR(obj->sg)) { + DRM_ERROR("failed to allocate sgt.\n"); + return ERR_CAST(obj->sg); } sgt = &udl_attach->sgt;