Fix the smatch warning,
smatch warnings:
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:2146 amdgpu_pt_info_read()
error: we previously assumed 'fpriv' could be null (see line 2146)

"if (!fpriv && !fpriv->vm.root.bo)", It has to be an OR condition
rather than an AND which makes an NULL dereference in case fpriv is NULL.

Reported-by: kernel test robot <l...@intel.com>
Closes: 
https://lore.kernel.org/oe-kbuild-all/202507090525.9rdwghz3-...@intel.com/
Signed-off-by: Sunil Khatri <sunil.kha...@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
index e49890a23ef6..63cd790b1d7b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
@@ -2143,7 +2143,7 @@ static int amdgpu_pt_info_read(struct seq_file *m, void 
*unused)
                return -EINVAL;
 
        fpriv = file->driver_priv;
-       if (!fpriv && !fpriv->vm.root.bo)
+       if (!fpriv || !fpriv->vm.root.bo)
                return -ENODEV;
 
        root_bo = amdgpu_bo_ref(fpriv->vm.root.bo);
-- 
2.34.1

Reply via email to