提交 e38648f9 编写于 作者: H Haixia Shi 提交者: Dave Airlie

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: NHaixia Shi <hshi@chromium.org>
Reviewed-by: NStéphane Marchesin <marcheu@chromium.org>
Signed-off-by: NDave Airlie <airlied@redhat.com>
上级 4bc158e0
...@@ -99,9 +99,9 @@ static struct sg_table *udl_map_dma_buf(struct dma_buf_attachment *attach, ...@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册