drm/amdgpu: Remove unnecessary NULL check
authorKent Russell <kent.russell@amd.com>
Thu, 2 Jan 2025 14:21:46 +0000 (09:21 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 6 Jan 2025 19:44:29 +0000 (14:44 -0500)
container_of cannot return NULL, so it is unnecessary to check for
NULL after gem_to_amdgpu_bo, which is just a container_of call

Signed-off-by: Kent Russell <kent.russell@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c

index 1a5df8b9466161eda0007d74aa7c817c7b1e9b0c..8dba7425501c1c38d0462cb3e2a22df1eeb0bf65 100644 (file)
@@ -87,10 +87,8 @@ static void amdgpu_gem_object_free(struct drm_gem_object *gobj)
 {
        struct amdgpu_bo *aobj = gem_to_amdgpu_bo(gobj);
 
-       if (aobj) {
-               amdgpu_hmm_unregister(aobj);
-               ttm_bo_put(&aobj->tbo);
-       }
+       amdgpu_hmm_unregister(aobj);
+       ttm_bo_put(&aobj->tbo);
 }
 
 int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size,