[PATCH v3] drm/amdkfd: Remove bo NULL check in gmc_v12_0_get_vm_pte() function

Russell, Kent Kent.Russell at amd.com
Wed May 15 13:04:10 UTC 2024


[AMD Official Use Only - AMD Internal Distribution Only]

Reviewed-by: Kent Russell <kent.russell at amd.com>



> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> On Behalf Of Sreekant
> Somasekharan
> Sent: Tuesday, May 14, 2024 8:31 PM
> To: amd-gfx at lists.freedesktop.org
> Cc: Kuehling, Felix <Felix.Kuehling at amd.com>; Somasekharan, Sreekant
> <Sreekant.Somasekharan at amd.com>; Dan Carpenter
> <dan.carpenter at linaro.org>
> Subject: [PATCH v3] drm/amdkfd: Remove bo NULL check in
> gmc_v12_0_get_vm_pte() function
>
> Remove bo NULL check in amdgpu/gmc_v12_0.c:gmc_v12_0_get_vm_pte()
> function
> to fix smatch warning:
>
> 'drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c:518 gmc_v12_0_get_vm_pte()
> warn: variable dereferenced before check 'bo' (see line 500)'
>
> Signed-off-by: Sreekant Somasekharan <sreekant.somasekharan at amd.com>
> Suggested-by: Dan Carpenter <dan.carpenter at linaro.org>
> ---
>  drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c
> b/drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c
> index 2b7b67916c1d..0fadebec9019 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c
> @@ -515,13 +515,13 @@ static void gmc_v12_0_get_vm_pte(struct
> amdgpu_device *adev,
>               *flags &= ~AMDGPU_PTE_VALID;
>       }
>
> -     if (bo && bo->flags & (AMDGPU_GEM_CREATE_COHERENT |
> +     if (bo->flags & (AMDGPU_GEM_CREATE_COHERENT |
>                              AMDGPU_GEM_CREATE_UNCACHED))
>               *flags = (*flags & ~AMDGPU_PTE_MTYPE_GFX12_MASK) |
>                        AMDGPU_PTE_MTYPE_GFX12(MTYPE_UC);
>
>       /* WA for HW bug */
> -     if ((bo && is_system) || ((bo_adev != adev) && coherent))
> +     if (is_system || ((bo_adev != adev) && coherent))
>               *flags |= AMDGPU_PTE_MTYPE_GFX12(MTYPE_NC);
>
>  }
> --
> 2.34.1



More information about the amd-gfx mailing list