diff mbox series

[v3,3/8] drm/omap: accept NULL for dma_addr in omap_gem_pin

Message ID 20191007112555.25278-4-jjhiblot@ti.com
State Superseded
Headers show
Series None | expand

Commit Message

Jean-Jacques Hiblot Oct. 7, 2019, 11:25 a.m. UTC
From: Tomi Valkeinen <tomi.valkeinen@ti.com>

Allow NULL to be passed in 'dma_addr' for omap_gem_pin(), in case the
caller does not need the dma_addr.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/omap_gem.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Jean-Jacques Hiblot Oct. 8, 2019, 3:55 p.m. UTC | #1
On 07/10/2019 13:25, Jean-Jacques Hiblot wrote:
> From: Tomi Valkeinen <tomi.valkeinen@ti.com>
>
> Allow NULL to be passed in 'dma_addr' for omap_gem_pin(), in case the
> caller does not need the dma_addr.
>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>   drivers/gpu/drm/omapdrm/omap_gem.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm/omapdrm/omap_gem.c
> index 9201c21e206f..a6562d23d314 100644
> --- a/drivers/gpu/drm/omapdrm/omap_gem.c
> +++ b/drivers/gpu/drm/omapdrm/omap_gem.c
> @@ -819,9 +819,11 @@ int omap_gem_pin(struct drm_gem_object *obj, dma_addr_t *dma_addr)
>   			refcount_inc(&omap_obj->dma_addr_cnt);
>   		}
>   
> -		*dma_addr = omap_obj->dma_addr;
> +		if (dma_addr)
> +			*dma_addr = omap_obj->dma_addr;
>   	} else if (omap_gem_is_contiguous(omap_obj)) {
> -		*dma_addr = omap_obj->dma_addr;
> +		if (dma_addr)
> +			*dma_addr = omap_obj->dma_addr;
>   	} else {
>   		ret = -EINVAL;
>   		goto fail;
Reviewed-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm/omapdrm/omap_gem.c
index 9201c21e206f..a6562d23d314 100644
--- a/drivers/gpu/drm/omapdrm/omap_gem.c
+++ b/drivers/gpu/drm/omapdrm/omap_gem.c
@@ -819,9 +819,11 @@  int omap_gem_pin(struct drm_gem_object *obj, dma_addr_t *dma_addr)
 			refcount_inc(&omap_obj->dma_addr_cnt);
 		}
 
-		*dma_addr = omap_obj->dma_addr;
+		if (dma_addr)
+			*dma_addr = omap_obj->dma_addr;
 	} else if (omap_gem_is_contiguous(omap_obj)) {
-		*dma_addr = omap_obj->dma_addr;
+		if (dma_addr)
+			*dma_addr = omap_obj->dma_addr;
 	} else {
 		ret = -EINVAL;
 		goto fail;