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@xxxxxxx> Suggested-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> --- 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