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

Russell, Kent Kent.Russell at amd.com
Fri May 10 14:16:36 UTC 2024


[AMD Official Use Only - General]

Never mind, we're good. This one is

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


> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> On Behalf Of Russell,
> Kent
> Sent: Friday, May 10, 2024 9:16 AM
> To: Somasekharan, Sreekant <Sreekant.Somasekharan at amd.com>; 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: RE: [PATCH 1/2] drm/amdkfd: Remove bo NULL check in
> gmc_v12_0_get_vm_pte() function
>
> [AMD Official Use Only - General]
>
> [AMD Official Use Only - General]
>
> Do we need to check whether bo is NULL in line 500 first? Or can it never be
> NULL?
>
>  Kent
>
> > -----Original Message-----
> > From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> On Behalf Of
> Sreekant
> > Somasekharan
> > Sent: Friday, May 10, 2024 12:56 AM
> > 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 1/2] 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 | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c
> > b/drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c
> > index 5dcd55d390d8..df0363ad1a51 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c
> > @@ -511,16 +511,16 @@ 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);
> >
> > -     if (bo && bo->flags & AMDGPU_GEM_CREATE_GFX12_DCC)
> > +     if (bo->flags & AMDGPU_GEM_CREATE_GFX12_DCC)
> >               *flags |= AMDGPU_PTE_DCC;
> >
> >       /* 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