summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoonyoung Shim <jy0922.shim@samsung.com>2013-07-04 07:19:12 (GMT)
committerInki Dae <inki.dae@samsung.com>2014-10-15 11:05:11 (GMT)
commit80951df34dc38e11838d931365118ca3b6c0772f (patch)
treee281330c413d1a6900dec08fe8c5da321580e463
parentc3de19e51e4f67bb7ca110c31e36774efe1e3dfa (diff)
downloadlinux-3.10-80951df34dc38e11838d931365118ca3b6c0772f.zip
linux-3.10-80951df34dc38e11838d931365118ca3b6c0772f.tar.gz
linux-3.10-80951df34dc38e11838d931365118ca3b6c0772f.tar.bz2
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>
-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 533fccf..ae851b0 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;