diff mbox series

[06/45] drm/vmwgfx: move null mem checks outside move notifies

Message ID 20200924051845.397177-7-airlied@gmail.com
State New, archived
Headers show
Series TTM move refactoring | expand

Commit Message

Dave Airlie Sept. 24, 2020, 5:18 a.m. UTC
From: Dave Airlie <airlied@redhat.com>

Both fns checked mem == NULL, just move the check outside.

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_bo.c         | 3 ---
 drivers/gpu/drm/vmwgfx/vmwgfx_resource.c   | 2 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 2 ++
 3 files changed, 3 insertions(+), 4 deletions(-)

Comments

Christian König Sept. 24, 2020, 11:12 a.m. UTC | #1
Am 24.09.20 um 07:18 schrieb Dave Airlie:
> From: Dave Airlie <airlied@redhat.com>
>
> Both fns checked mem == NULL, just move the check outside.
>
> Signed-off-by: Dave Airlie <airlied@redhat.com>

Acked-by: Christian König <christian.koenig@amd.com>

> ---
>   drivers/gpu/drm/vmwgfx/vmwgfx_bo.c         | 3 ---
>   drivers/gpu/drm/vmwgfx/vmwgfx_resource.c   | 2 +-
>   drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 2 ++
>   3 files changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c b/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c
> index a1f675c5f471..b09f4f064ae4 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c
> @@ -1191,9 +1191,6 @@ void vmw_bo_move_notify(struct ttm_buffer_object *bo,
>   {
>   	struct vmw_buffer_object *vbo;
>   
> -	if (mem == NULL)
> -		return;
> -
>   	/* Make sure @bo is embedded in a struct vmw_buffer_object? */
>   	if (bo->destroy != vmw_bo_bo_free &&
>   	    bo->destroy != vmw_user_bo_destroy)
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
> index 5e922d9d5f2c..00b535831a7a 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
> @@ -867,7 +867,7 @@ void vmw_query_move_notify(struct ttm_buffer_object *bo,
>   	mutex_lock(&dev_priv->binding_mutex);
>   
>   	dx_query_mob = container_of(bo, struct vmw_buffer_object, base);
> -	if (mem == NULL || !dx_query_mob || !dx_query_mob->dx_query_ctx) {
> +	if (!dx_query_mob || !dx_query_mob->dx_query_ctx) {
>   		mutex_unlock(&dev_priv->binding_mutex);
>   		return;
>   	}
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c
> index fc68f54df46a..2f88d2d79f9a 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c
> @@ -707,6 +707,8 @@ static void vmw_move_notify(struct ttm_buffer_object *bo,
>   			    bool evict,
>   			    struct ttm_resource *mem)
>   {
> +	if (!mem)
> +		return;
>   	vmw_bo_move_notify(bo, mem);
>   	vmw_query_move_notify(bo, mem);
>   }
diff mbox series

Patch

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c b/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c
index a1f675c5f471..b09f4f064ae4 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c
@@ -1191,9 +1191,6 @@  void vmw_bo_move_notify(struct ttm_buffer_object *bo,
 {
 	struct vmw_buffer_object *vbo;
 
-	if (mem == NULL)
-		return;
-
 	/* Make sure @bo is embedded in a struct vmw_buffer_object? */
 	if (bo->destroy != vmw_bo_bo_free &&
 	    bo->destroy != vmw_user_bo_destroy)
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
index 5e922d9d5f2c..00b535831a7a 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
@@ -867,7 +867,7 @@  void vmw_query_move_notify(struct ttm_buffer_object *bo,
 	mutex_lock(&dev_priv->binding_mutex);
 
 	dx_query_mob = container_of(bo, struct vmw_buffer_object, base);
-	if (mem == NULL || !dx_query_mob || !dx_query_mob->dx_query_ctx) {
+	if (!dx_query_mob || !dx_query_mob->dx_query_ctx) {
 		mutex_unlock(&dev_priv->binding_mutex);
 		return;
 	}
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c
index fc68f54df46a..2f88d2d79f9a 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c
@@ -707,6 +707,8 @@  static void vmw_move_notify(struct ttm_buffer_object *bo,
 			    bool evict,
 			    struct ttm_resource *mem)
 {
+	if (!mem)
+		return;
 	vmw_bo_move_notify(bo, mem);
 	vmw_query_move_notify(bo, mem);
 }