diff options
author | Joonyoung Shim <jy0922.shim@samsung.com> | 2013-07-04 09:19:12 +0200 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2013-07-05 07:36:20 +0200 |
commit | f9d8a1294d37449f3f1b842ffb275e2ca41f5cf4 (patch) | |
tree | 015b94316caaf63df9278dba5695eb49f773ac77 | |
parent | Merge branch 'exynos-drm-next' of git://git.kernel.org/pub/scm/linux/kernel/g... (diff) | |
download | linux-f9d8a1294d37449f3f1b842ffb275e2ca41f5cf4.tar.xz linux-f9d8a1294d37449f3f1b842ffb275e2ca41f5cf4.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>
-rw-r--r-- | drivers/gpu/drm/drm_prime.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c index 1e0de41f085c..ff5fecef367b 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; |