diff mbox

[2/2] DRM: Exynos: check for null in return value of dma_buf_map_attachment()

Message ID 1340648577-28402-3-git-send-email-subash.ramaswamy@linaro.org
State Accepted
Commit 0dd3b72cc66117e5c6dc638f55e4f2e5cc60ed70
Headers show

Commit Message

Subash Patel June 25, 2012, 6:22 p.m. UTC
From: Subash Patel <subash.rp@samsung.com>

dma_buf_map_attachment() can return NULL and valid sg as return
value. Hence the check for the returned scatter-gather must be using
the inline function IS_ERR_OR_NULL() in place of IS_ERR()

Change-Id: I33218480e220f6a26a1e726b336bf533a95363de
Signed-off-by: Subash Patel <subash.ramaswamy@linaro.org>
CC: dri-devel@lists.freedesktop.org
CC: linux-samsung-soc@vger.kernel.org
CC: linaro-mm-sig@lists.linaro.org
CC: inki.dae@samsung.com
CC: airlied@redhat.com
CC: olofj@chromium.org
---
 drivers/gpu/drm/exynos/exynos_drm_dmabuf.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

대인기/Tizen Platform Lab(SR)/삼성전자 June 27, 2012, 2:17 a.m. UTC | #1
> -----Original Message-----
> From: Subash Patel [mailto:subashrp@gmail.com]
> Sent: Tuesday, June 26, 2012 3:23 AM
> To: dri-devel@lists.freedesktop.org; linux-samsung-soc@vger.kernel.org;
> linaro-mm-sig@lists.linaro.org
> Cc: olofj@chromium.org; inki.dae@samsung.com; airlied@redhat.com; Subash
> Patel; Subash Patel
> Subject: [PATCH 2/2] DRM: Exynos: check for null in return value of
> dma_buf_map_attachment()
> 
> From: Subash Patel <subash.rp@samsung.com>
> 
> dma_buf_map_attachment() can return NULL and valid sg as return
> value. Hence the check for the returned scatter-gather must be using
> the inline function IS_ERR_OR_NULL() in place of IS_ERR()
> 
> Change-Id: I33218480e220f6a26a1e726b336bf533a95363de
> Signed-off-by: Subash Patel <subash.ramaswamy@linaro.org>
> CC: dri-devel@lists.freedesktop.org
> CC: linux-samsung-soc@vger.kernel.org
> CC: linaro-mm-sig@lists.linaro.org
> CC: inki.dae@samsung.com
> CC: airlied@redhat.com
> CC: olofj@chromium.org
> ---
>  drivers/gpu/drm/exynos/exynos_drm_dmabuf.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c
> b/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c
> index 52cf761..c908a29 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c
> @@ -245,7 +245,7 @@ struct drm_gem_object
> *exynos_dmabuf_prime_import(struct drm_device *drm_dev,
> 
> 
>  	sgt = dma_buf_map_attachment(attach, DMA_BIDIRECTIONAL);
> -	if (IS_ERR(sgt)) {
> +	if (IS_ERR_OR_NULL(sgt)) {
>  		ret = PTR_ERR(sgt);
>  		goto err_buf_detach;
>  	}
> --
> 1.7.9.5

Applied.

Thanks,
Inki Dae
diff mbox

Patch

diff --git a/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c b/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c
index 52cf761..c908a29 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c
@@ -245,7 +245,7 @@  struct drm_gem_object *exynos_dmabuf_prime_import(struct drm_device *drm_dev,
 
 
 	sgt = dma_buf_map_attachment(attach, DMA_BIDIRECTIONAL);
-	if (IS_ERR(sgt)) {
+	if (IS_ERR_OR_NULL(sgt)) {
 		ret = PTR_ERR(sgt);
 		goto err_buf_detach;
 	}