[PATCH 3/7] drm/ttm: tt destroy move null check to outer function.

Dave Airlie airlied at gmail.com
Tue Sep 15 02:40:03 UTC 2020


From: Dave Airlie <airlied at redhat.com>

This just makes things easier later.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 drivers/gpu/drm/ttm/ttm_bo_util.c | 2 ++
 drivers/gpu/drm/ttm/ttm_tt.c      | 3 ---
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
index 0ddaaa1ddafd..f3452a1624fd 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_util.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
@@ -699,6 +699,8 @@ int ttm_bo_pipeline_gutting(struct ttm_buffer_object *bo)
 
 void ttm_bo_tt_destroy(struct ttm_buffer_object *bo)
 {
+	if (bo->ttm == NULL)
+		return;
 	ttm_tt_destroy(bo->bdev, bo->ttm);
 	bo->ttm = NULL;
 }
diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
index ff3d953aa90e..381face3cedb 100644
--- a/drivers/gpu/drm/ttm/ttm_tt.c
+++ b/drivers/gpu/drm/ttm/ttm_tt.c
@@ -209,9 +209,6 @@ EXPORT_SYMBOL(ttm_tt_set_placement_caching);
 
 void ttm_tt_destroy(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
 {
-	if (ttm == NULL)
-		return;
-
 	ttm_tt_unbind(bdev, ttm);
 
 	ttm_tt_unpopulate(bdev, ttm);
-- 
2.27.0



More information about the dri-devel mailing list