summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorJoonyoung Shim <jy0922.shim@samsung.com>2013-07-04 16:19:12 +0900
committerChanho Park <chanho61.park@samsung.com>2014-11-21 19:12:23 +0900
commit8423b4dac06cd2f2e12601af7cf9af1c6edd7022 (patch)
tree5f136c79941d71d0f5a95196083f9a8bde3bb594 /drivers/gpu/drm
parentf5f0c4cb2168ec5ec793b4f6c6186d3291c2de67 (diff)
downloadlinux-3.10-8423b4dac06cd2f2e12601af7cf9af1c6edd7022.tar.gz
linux-3.10-8423b4dac06cd2f2e12601af7cf9af1c6edd7022.tar.bz2
linux-3.10-8423b4dac06cd2f2e12601af7cf9af1c6edd7022.zip
drm/prime: fix sgt NULL checking
The drm_gem_map_detach() can be called with sgt is NULL. Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/drm_prime.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
index 533fccfe01c..ae851b04d1b 100644
--- a/drivers/gpu/drm/drm_prime.c
+++ b/drivers/gpu/drm/drm_prime.c
@@ -119,12 +119,13 @@ static void drm_gem_map_detach(struct dma_buf *dma_buf,
return;
sgt = prime_attach->sgt;
+ if (sgt) {
+ if (prime_attach->dir != DMA_NONE)
+ dma_unmap_sg(attach->dev, sgt->sgl, sgt->nents,
+ prime_attach->dir);
+ sg_free_table(sgt);
+ }
- if (prime_attach->dir != DMA_NONE)
- dma_unmap_sg(attach->dev, sgt->sgl, sgt->nents,
- prime_attach->dir);
-
- sg_free_table(sgt);
kfree(sgt);
kfree(prime_attach);
attach->priv = NULL;