diff options
author | Lucas Stach <l.stach@pengutronix.de> | 2016-11-30 15:26:26 +0100 |
---|---|---|
committer | Lucas Stach <l.stach@pengutronix.de> | 2016-12-02 19:30:23 +0100 |
commit | 5f4a4a73f437b007019495c3c789599d71b9c59e (patch) | |
tree | 95266e6635a76cb0ea822cfcc616d4e2ca8f320c /drivers/gpu/drm/etnaviv | |
parent | 557800532ebdec4fc460876af4e3c216d23a184d (diff) | |
download | linux-5f4a4a73f437b007019495c3c789599d71b9c59e.tar.bz2 |
drm/etnaviv: fix gem_prime_get_sg_table to return new SG table
The object internal SG table must not be returned, as the caller
will take ownership of the returned table.
Construct a new table from the object pages and return this one
instead.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Diffstat (limited to 'drivers/gpu/drm/etnaviv')
-rw-r--r-- | drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c index 7e8fdb1859dd..62b47972a52e 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c @@ -23,10 +23,12 @@ struct sg_table *etnaviv_gem_prime_get_sg_table(struct drm_gem_object *obj) { struct etnaviv_gem_object *etnaviv_obj = to_etnaviv_bo(obj); + int npages = obj->size >> PAGE_SHIFT; - BUG_ON(!etnaviv_obj->sgt); /* should have already pinned! */ + if (WARN_ON(!etnaviv_obj->pages)) /* should have already pinned! */ + return NULL; - return etnaviv_obj->sgt; + return drm_prime_pages_to_sg(etnaviv_obj->pages, npages); } void *etnaviv_gem_prime_vmap(struct drm_gem_object *obj) |