[PATCH] drm/amdgpu: Drop 'fence' check in 'to_amdgpu_amdkfd_fence()'

Felix Kuehling felix.kuehling at amd.com
Tue Jan 2 16:18:42 UTC 2024


On 2023-12-29 10:12, Srinivasan Shanmugam wrote:
> 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 at amd.com>
> Cc: Christian König <christian.koenig at amd.com>
> Cc: Alex Deucher <alexander.deucher at amd.com>
> Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam at amd.com>

Reviewed-by: Felix Kuehling <felix.kuehling at amd.com>


> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c
> index 469785d33791..1ef758ac5076 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c
> @@ -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;


More information about the amd-gfx mailing list