drm/amdgpu: Remove unnecessary NULL check
Subsystems (2)
PATCH 1/1 drm/amdgpu: Remove unnecessary NULL check
container_of cannot return NULL, so it is unnecessary to check for NULL after gem_to_amdgpu_bo, which just is a container_of call
Signed-off-by Kent Russell <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +2 -4
@@ -196,10 +196,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,
Signature · 1 line
2.43.0
Quoted 4 lines · Kent Russell
container_ofcannot return NULL, so it is unnecessary to check for NULL aftergem_to_amdgpu_bo, which just is acontainer_ofcallSigned-off-by Kent Russell <[email protected]>
Reviewed-by Felix Kuehling <[email protected]>
Quoted 21 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +2
-4@@ -196,10 +196,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,