[PATCH][next] drm/ttm: remove redundant ternaray operation on ret

Colin Ian King colin.i.king at gmail.com
Wed Jul 2 09:25:41 UTC 2025


Currently the only exit path to the end of the function
__ttm_bo_lru_cursor_next is when pointer res is NULL. The
ternary operation at the end of the function that checks on
the value of res is redundant as res can never be non-null
and hence the expression referencing pointer bo is never
executed. Clean up the code by replacing the ternary operator
with just a simple return of NULL

Signed-off-by: Colin Ian King <colin.i.king at gmail.com>
---
 drivers/gpu/drm/ttm/ttm_bo_util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
index cdee664d2e8b..fb8bef50c744 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_util.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
@@ -1016,7 +1016,7 @@ __ttm_bo_lru_cursor_next(struct ttm_bo_lru_cursor *curs)
 	}
 
 	spin_unlock(lru_lock);
-	return res ? bo : NULL;
+	return NULL;
 }
 
 /**
-- 
2.50.0



More information about the dri-devel mailing list