[PATCH] drm/amdgpu: Remove unnecessary NULL check
Felix Kuehling
felix.kuehling at amd.com
Fri Jan 3 22:48:40 UTC 2025
On 2025-01-02 10:01, Kent Russell wrote:
> 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 <kent.russell at amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling at amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> index 7edccb675921..a1691ed717da 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> @@ -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,
More information about the amd-gfx
mailing list