Skip to content

Commit a204ea8

Browse files
lituo1996alexdeucher
authored andcommitted
drm/amdgpu: drop redundant null-pointer checks in amdgpu_ttm_tt_populate() and amdgpu_ttm_tt_unpopulate()
The varialbe gtt in the function amdgpu_ttm_tt_populate() and amdgpu_ttm_tt_unpopulate() is guaranteed to be not NULL in the context. Thus the null-pointer checks are redundant and can be dropped. Reported-by: TOTE Robot <[email protected]> Reviewed-by: Christian König <[email protected]> Signed-off-by: Tuo Li <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 11e612a commit a204ea8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,7 +1123,7 @@ static int amdgpu_ttm_tt_populate(struct ttm_device *bdev,
11231123
struct amdgpu_ttm_tt *gtt = (void *)ttm;
11241124

11251125
/* user pages are bound by amdgpu_ttm_tt_pin_userptr() */
1126-
if (gtt && gtt->userptr) {
1126+
if (gtt->userptr) {
11271127
ttm->sg = kzalloc(sizeof(struct sg_table), GFP_KERNEL);
11281128
if (!ttm->sg)
11291129
return -ENOMEM;
@@ -1148,7 +1148,7 @@ static void amdgpu_ttm_tt_unpopulate(struct ttm_device *bdev,
11481148
struct amdgpu_ttm_tt *gtt = (void *)ttm;
11491149
struct amdgpu_device *adev;
11501150

1151-
if (gtt && gtt->userptr) {
1151+
if (gtt->userptr) {
11521152
amdgpu_ttm_tt_set_user_pages(ttm, NULL);
11531153
kfree(ttm->sg);
11541154
ttm->sg = NULL;

0 commit comments

Comments
 (0)