linux-5.7-rc4/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c:1393: bad loop termination condition ?

David Binderman dcb314 at hotmail.com
Mon May 4 08:07:46 UTC 2020


Hello there,

linux-5.7-rc4/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c:1393:63: style: Unsigned expression 'j' can't be negative so it is unnecessary to test it. [unsignedPositive]

Source code is 

            for (closest_clk_lvl = 0, j = dcn2_1_soc.num_states - 1; j >= 0; j--) {

but

    unsigned int i, j, closest_clk_lvl;

so it looks like the loop never terminates. Suggest code rework.

Regards

David Binderman


More information about the amd-gfx mailing list