Hello John Clements,

The patch cbb8f989d5a0: "drm/amdgpu: page retire over debugfs
mechanism" from Apr 9, 2021, leads to the following static checker
warning:

        drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:377 
amdgpu_ras_debugfs_ctrl_write()
        info: return a literal instead of 'ret'

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
   366          ret = amdgpu_ras_debugfs_ctrl_parse_data(f, buf, size, pos, 
&data);
   367          if (ret)
   368                  return -EINVAL;
   369  
   370          if (data.op == 3)
   371          {
                ^
Please use scripts/checkpatch.pl...  :(  Bonus points for replacing the
magic number 3 with a define?

   372                  ret = amdgpu_reserve_page_direct(adev, 
data.inject.address);
   373  
   374                  if (ret)
   375                          return size;
   376                  else
   377                          return ret;

This static checker warning is disguised as a style warning, but it's
really to detect code like this where the if statements are reversed as
appears to be the case here.

                ret = amdgpu_reserve_page_direct(adev, data.inject.address);
                if (ret)
                        return ret;

                return size;

   378          }
   379  
   380          if (!amdgpu_ras_is_supported(adev, data.head.block))
   381                  return -EINVAL;

regards,
dan carpenter
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to