[bug report] drm/amdgpu/vpe: enable vpe dpm

Dan Carpenter dan.carpenter at linaro.org
Fri Jan 5 13:33:37 UTC 2024


Hello Peyton Lee,

The patch 5f82a0c90cca: "drm/amdgpu/vpe: enable vpe dpm" from Dec 12,
2023 (linux-next), leads to the following Smatch static checker
warning:

drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c:62 vpe_u1_8_from_fraction() warn: unsigned 'numerator' is never less than zero.
drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c:63 vpe_u1_8_from_fraction() warn: unsigned 'denominator' is never less than zero.

drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c
    60 static uint16_t vpe_u1_8_from_fraction(uint16_t numerator, uint16_t denominator)
    61 {
--> 62         bool arg1_negative = numerator < 0;
    63         bool arg2_negative = denominator < 0;

uint16_t can't be negative.

    64 
    65         uint16_t arg1_value = (uint16_t)(arg1_negative ? -numerator : numerator);
    66         uint16_t arg2_value = (uint16_t)(arg2_negative ? -denominator : denominator);
    67 
    68         uint16_t remainder;
    69 

regards,
dan carpenter


More information about the amd-gfx mailing list