drm/amdgpu: Drop 'fence' check in 'to_amdgpu_amdkfd_fence()'
authorSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Wed, 27 Dec 2023 07:24:44 +0000 (12:54 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 5 Feb 2024 20:14:30 +0000 (20:14 +0000)
[ Upstream commit bf2ad4fb8adca89374b54b225d494e0b1956dbea ]

Return value of container_of(...) can't be null, so null check is not
required for 'fence'. Hence drop its NULL check.

Fixes the below:
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c:93 to_amdgpu_amdkfd_fence() warn: can 'fence' even be NULL?

Cc: Felix Kuehling <Felix.Kuehling@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c

index 469785d..1ef758a 100644 (file)
@@ -90,7 +90,7 @@ struct amdgpu_amdkfd_fence *to_amdgpu_amdkfd_fence(struct dma_fence *f)
                return NULL;
 
        fence = container_of(f, struct amdgpu_amdkfd_fence, base);
-       if (fence && f->ops == &amdkfd_fence_ops)
+       if (f->ops == &amdkfd_fence_ops)
                return fence;
 
        return NULL;