Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu: remove always false comparison in 'amdgpu_atombios_i2c_process_i2c_ch'

Fixes gcc '-Wtype-limits' warning:

drivers/gpu/drm/amd/amdgpu/atombios_i2c.c: In function
‘amdgpu_atombios_i2c_process_i2c_ch’:
drivers/gpu/drm/amd/amdgpu/atombios_i2c.c:79:11: warning: comparison is
always false due to limited range of data type [-Wtype-limits]

'num' is 'u8', so it will never be greater than 'TOM_MAX_HW_I2C_READ',
which is defined as 255. Therefore, the comparison can be removed.

Fixes: d38ceaf99ed0 ("drm/amdgpu: add core driver (v4)")
Signed-off-by: yu kuai <yukuai3@huawei.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

yu kuai and committed by
Alex Deucher
220ac8d1 d1d09dc4

-5
-5
drivers/gpu/drm/amd/amdgpu/atombios_i2c.c
··· 76 76 } 77 77 args.lpI2CDataOut = cpu_to_le16(out); 78 78 } else { 79 - if (num > ATOM_MAX_HW_I2C_READ) { 80 - DRM_ERROR("hw i2c: tried to read too many bytes (%d vs 255)\n", num); 81 - r = -EINVAL; 82 - goto done; 83 - } 84 79 args.ucRegIndex = 0; 85 80 args.lpI2CDataOut = 0; 86 81 }