Commit 4279cb14 authored by Christian König's avatar Christian König Committed by Alex Deucher

drm/ttm: remove NULL checks when calling ttm_tt_destroy

The function is a no-op with a NULL pointer.
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 089f16c5
...@@ -147,8 +147,7 @@ static void ttm_bo_release_list(struct kref *list_kref) ...@@ -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->lru));
BUG_ON(!list_empty(&bo->ddestroy)); 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); atomic_dec(&bo->glob->bo_count);
if (bo->resv == &bo->ttm_resv) if (bo->resv == &bo->ttm_resv)
reservation_object_fini(&bo->ttm_resv); reservation_object_fini(&bo->ttm_resv);
...@@ -396,7 +395,7 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, ...@@ -396,7 +395,7 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo,
out_err: out_err:
new_man = &bdev->man[bo->mem.mem_type]; 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); ttm_tt_destroy(bo->ttm);
bo->ttm = NULL; bo->ttm = NULL;
} }
...@@ -417,10 +416,8 @@ static void ttm_bo_cleanup_memtype_use(struct ttm_buffer_object *bo) ...@@ -417,10 +416,8 @@ static void ttm_bo_cleanup_memtype_use(struct ttm_buffer_object *bo)
if (bo->bdev->driver->move_notify) if (bo->bdev->driver->move_notify)
bo->bdev->driver->move_notify(bo, NULL); bo->bdev->driver->move_notify(bo, NULL);
if (bo->ttm) { ttm_tt_destroy(bo->ttm);
ttm_tt_destroy(bo->ttm); bo->ttm = NULL;
bo->ttm = NULL;
}
ttm_bo_mem_put(bo, &bo->mem); ttm_bo_mem_put(bo, &bo->mem);
ww_mutex_unlock (&bo->resv->lock); ww_mutex_unlock (&bo->resv->lock);
......
...@@ -400,7 +400,7 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo, ...@@ -400,7 +400,7 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo,
*old_mem = *new_mem; *old_mem = *new_mem;
new_mem->mm_node = NULL; 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); ttm_tt_destroy(ttm);
bo->ttm = NULL; bo->ttm = NULL;
} }
...@@ -647,8 +647,7 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo, ...@@ -647,8 +647,7 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
if (ret) if (ret)
return ret; return ret;
if ((man->flags & TTM_MEMTYPE_FLAG_FIXED) && if (man->flags & TTM_MEMTYPE_FLAG_FIXED) {
(bo->ttm != NULL)) {
ttm_tt_destroy(bo->ttm); ttm_tt_destroy(bo->ttm);
bo->ttm = NULL; bo->ttm = NULL;
} }
......
...@@ -168,7 +168,7 @@ void ttm_tt_destroy(struct ttm_tt *ttm) ...@@ -168,7 +168,7 @@ void ttm_tt_destroy(struct ttm_tt *ttm)
{ {
int ret; int ret;
if (unlikely(ttm == NULL)) if (ttm == NULL)
return; return;
if (ttm->state == tt_bound) { if (ttm->state == tt_bound) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment