drm/ttm: remove NULL checks when calling ttm_tt_destroy
authorChristian König <christian.koenig@amd.com>
Mon, 6 Jun 2016 08:17:51 +0000 (10:17 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 7 Jul 2016 18:54:33 +0000 (14:54 -0400)
The function is a no-op with a NULL pointer.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/ttm/ttm_bo.c
drivers/gpu/drm/ttm/ttm_bo_util.c
drivers/gpu/drm/ttm/ttm_tt.c

index 4216b3162a8d0baf3826fb39340e00dcea2d3e4c..43a29555032e38c0d8a9f85aad24f8a704898480 100644 (file)
@@ -147,8 +147,7 @@ static void ttm_bo_release_list(struct kref *list_kref)
        BUG_ON(!list_empty(&bo->lru));
        BUG_ON(!list_empty(&bo->ddestroy));
 
-       if (bo->ttm)
-               ttm_tt_destroy(bo->ttm);
+       ttm_tt_destroy(bo->ttm);
        atomic_dec(&bo->glob->bo_count);
        if (bo->resv == &bo->ttm_resv)
                reservation_object_fini(&bo->ttm_resv);
@@ -396,7 +395,7 @@ moved:
 
 out_err:
        new_man = &bdev->man[bo->mem.mem_type];
-       if ((new_man->flags & TTM_MEMTYPE_FLAG_FIXED) && bo->ttm) {
+       if (new_man->flags & TTM_MEMTYPE_FLAG_FIXED) {
                ttm_tt_destroy(bo->ttm);
                bo->ttm = NULL;
        }
@@ -417,10 +416,8 @@ static void ttm_bo_cleanup_memtype_use(struct ttm_buffer_object *bo)
        if (bo->bdev->driver->move_notify)
                bo->bdev->driver->move_notify(bo, NULL);
 
-       if (bo->ttm) {
-               ttm_tt_destroy(bo->ttm);
-               bo->ttm = NULL;
-       }
+       ttm_tt_destroy(bo->ttm);
+       bo->ttm = NULL;
        ttm_bo_mem_put(bo, &bo->mem);
 
        ww_mutex_unlock (&bo->resv->lock);
index 4194b7ea7a725f7cb5413cda4a6ed46cc09f0d45..0f4bcb0d594b53f8e5e617b0a9923c06c00365eb 100644 (file)
@@ -400,7 +400,7 @@ out2:
        *old_mem = *new_mem;
        new_mem->mm_node = NULL;
 
-       if ((man->flags & TTM_MEMTYPE_FLAG_FIXED) && (ttm != NULL)) {
+       if (man->flags & TTM_MEMTYPE_FLAG_FIXED) {
                ttm_tt_destroy(ttm);
                bo->ttm = NULL;
        }
@@ -647,8 +647,7 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
                if (ret)
                        return ret;
 
-               if ((man->flags & TTM_MEMTYPE_FLAG_FIXED) &&
-                   (bo->ttm != NULL)) {
+               if (man->flags & TTM_MEMTYPE_FLAG_FIXED) {
                        ttm_tt_destroy(bo->ttm);
                        bo->ttm = NULL;
                }
index 79f6323771e2678db140f280832f9817dd5e5ba4..d28d4333dcce091fb36c6d6242b2328e8eb9f3e2 100644 (file)
@@ -168,7 +168,7 @@ void ttm_tt_destroy(struct ttm_tt *ttm)
 {
        int ret;
 
-       if (unlikely(ttm == NULL))
+       if (ttm == NULL)
                return;
 
        if (ttm->state == tt_bound) {