drm/vmwgfx: move null mem checks outside move notifies
authorDave Airlie <airlied@redhat.com>
Tue, 6 Oct 2020 00:06:41 +0000 (10:06 +1000)
committerDave Airlie <airlied@redhat.com>
Wed, 7 Oct 2020 05:41:49 +0000 (15:41 +1000)
Both fns checked mem == NULL, just move the check outside.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201006000644.1005758-3-airlied@gmail.com
drivers/gpu/drm/vmwgfx/vmwgfx_bo.c
drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c

index 9a66ba25432639b33d9283475f4b676bc25d8bc3..263d76ae43f02d870a0670d57fc4b7efab908088 100644 (file)
@@ -1192,9 +1192,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)
index 5e922d9d5f2ccbc5dbad0edffd3bf7a72db79d3e..00b535831a7a7767b36ded6f6d6957f8b18dc6ee 100644 (file)
@@ -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;
        }
index fc68f54df46a697a82d7ca86f2c1d2348d705808..2f88d2d79f9a4c49ee971e939616bad429d207f8 100644 (file)
@@ -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);
 }