Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e38648f9 authored by Haixia Shi's avatar Haixia Shi Committed by Dave Airlie
Browse files

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: default avatarHaixia Shi <hshi@chromium.org>
Reviewed-by: default avatarStéphane Marchesin <marcheu@chromium.org>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 4bc158e0
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -99,9 +99,9 @@ static struct sg_table *udl_map_dma_buf(struct dma_buf_attachment *attach,


	page_count = obj->base.size / PAGE_SIZE;
	page_count = obj->base.size / PAGE_SIZE;
	obj->sg = drm_prime_pages_to_sg(obj->pages, page_count);
	obj->sg = drm_prime_pages_to_sg(obj->pages, page_count);
	if (!obj->sg) {
	if (IS_ERR(obj->sg)) {
		DRM_ERROR("sg is null.\n");
		DRM_ERROR("failed to allocate sgt.\n");
		return ERR_PTR(-ENOMEM);
		return ERR_CAST(obj->sg);
	}
	}


	sgt = &udl_attach->sgt;
	sgt = &udl_attach->sgt;