diff options
author | YoungJun Cho <yj44.cho@samsung.com> | 2013-06-24 15:34:21 +0900 |
---|---|---|
committer | Chanho Park <chanho61.park@samsung.com> | 2014-11-21 19:12:22 +0900 |
commit | 671f9f6c8d5480a60dd5899e6ebdb68ecc1321a3 (patch) | |
tree | 225e58f8271c7a27c5af48cda346b8930daa3181 /drivers | |
parent | ecfafa3bb7ce2e700c964f3787af7d31eadaed30 (diff) | |
download | linux-3.10-671f9f6c8d5480a60dd5899e6ebdb68ecc1321a3.tar.gz linux-3.10-671f9f6c8d5480a60dd5899e6ebdb68ecc1321a3.tar.bz2 linux-3.10-671f9f6c8d5480a60dd5899e6ebdb68ecc1321a3.zip |
drm/prime: fix to check return of dma_map_sg in prime helper
The dma_map_sg(), in map_dma_buf callback operation of prime helper,
can return 0 when it fails to map, so it needs to release related
resources.
Signed-off-by: YoungJun Cho <yj44.cho@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/drm_prime.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c index ffa6bdbe845..d8ba8f9f412 100644 --- a/drivers/gpu/drm/drm_prime.c +++ b/drivers/gpu/drm/drm_prime.c @@ -97,8 +97,13 @@ static struct sg_table *drm_gem_map_dma_buf(struct dma_buf_attachment *attach, sgt = obj->dev->driver->gem_prime_get_sg_table(obj); - if (!IS_ERR_OR_NULL(sgt)) - dma_map_sg(attach->dev, sgt->sgl, sgt->nents, dir); + if (!IS_ERR_OR_NULL(sgt)) { + if (!dma_map_sg(attach->dev, sgt->sgl, sgt->nents, dir)) { + sg_free_table(sgt); + kfree(sgt); + sgt = ERR_PTR(-ENOMEM); + } + } mutex_unlock(&obj->dev->struct_mutex); return sgt; |