aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/drm_prime.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
index 366910ddcfcb..25d02187067e 100644
--- a/drivers/gpu/drm/drm_prime.c
+++ b/drivers/gpu/drm/drm_prime.c
@@ -401,21 +401,17 @@ int drm_prime_fd_to_handle_ioctl(struct drm_device *dev, void *data,
401struct sg_table *drm_prime_pages_to_sg(struct page **pages, int nr_pages) 401struct sg_table *drm_prime_pages_to_sg(struct page **pages, int nr_pages)
402{ 402{
403 struct sg_table *sg = NULL; 403 struct sg_table *sg = NULL;
404 struct scatterlist *iter;
405 int i;
406 int ret; 404 int ret;
407 405
408 sg = kmalloc(sizeof(struct sg_table), GFP_KERNEL); 406 sg = kmalloc(sizeof(struct sg_table), GFP_KERNEL);
409 if (!sg) 407 if (!sg)
410 goto out; 408 goto out;
411 409
412 ret = sg_alloc_table(sg, nr_pages, GFP_KERNEL); 410 ret = sg_alloc_table_from_pages(sg, pages, nr_pages, 0,
411 nr_pages << PAGE_SHIFT, GFP_KERNEL);
413 if (ret) 412 if (ret)
414 goto out; 413 goto out;
415 414
416 for_each_sg(sg->sgl, iter, nr_pages, i)
417 sg_set_page(iter, pages[i], PAGE_SIZE, 0);
418
419 return sg; 415 return sg;
420out: 416out:
421 kfree(sg); 417 kfree(sg);