diff options
author | Rob Clark <robdclark@gmail.com> | 2015-07-23 19:44:56 +0200 |
---|---|---|
committer | Rob Clark <robdclark@gmail.com> | 2015-07-29 22:38:24 +0200 |
commit | ac45146733b03a1c8e3a6a33720bdc42804cc09b (patch) | |
tree | 9a0dc1b4c081e9f311a7fd9dd2ab5d611cca1712 /drivers/gpu | |
parent | Merge branch 'linux-4.2' of git://anongit.freedesktop.org/git/nouveau/linux-2... (diff) | |
download | linux-ac45146733b03a1c8e3a6a33720bdc42804cc09b.tar.xz linux-ac45146733b03a1c8e3a6a33720bdc42804cc09b.zip |
drm/msm: fix msm_gem_prime_get_sg_table()
We need to return a new sgt, since the caller takes ownership of it.
Reported-by: Stanimir Varbanov <svarbanov@mm-sol.com>
Signed-off-by: Rob Clark <robdclark@gmail.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/msm/msm_gem_prime.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/gpu/drm/msm/msm_gem_prime.c b/drivers/gpu/drm/msm/msm_gem_prime.c index dd7a7ab603e2..831461bc98a5 100644 --- a/drivers/gpu/drm/msm/msm_gem_prime.c +++ b/drivers/gpu/drm/msm/msm_gem_prime.c @@ -23,8 +23,12 @@ struct sg_table *msm_gem_prime_get_sg_table(struct drm_gem_object *obj) { struct msm_gem_object *msm_obj = to_msm_bo(obj); - BUG_ON(!msm_obj->sgt); /* should have already pinned! */ - return msm_obj->sgt; + int npages = obj->size >> PAGE_SHIFT; + + if (WARN_ON(!msm_obj->pages)) /* should have already pinned! */ + return NULL; + + return drm_prime_pages_to_sg(msm_obj->pages, npages); } void *msm_gem_prime_vmap(struct drm_gem_object *obj) |