• Ivan Lipski's avatar
    drm/amd/display: Remove reduntant comparisons by Coverity · fe6f61d4
    Ivan Lipski authored
    [WHY]
    Coverity analysis of the Upstream display driver code
    (amd-staging-drm-next) flagged these three functions as
    containing 'CONSTANT_EXPRESSION_RESULT' errors, i. e. the
    conditionals are reduntant since their result is predetermined.
    
    fixpt31_32.c:
    The two flagged 'ASSERT' lines redundant since they are always true:
    - LONG_MAX equals to the largest 'signed long long' number
    - res.value is type 'signed long long',
    
    So, the condition inside the 'ASSERTS's is always
    
    link_dp_training.c:
    The flagged conditional statement is always false:
    - 'max_requested.FFE_PRESET.settings.level' is 4 bits, so its max
      possible value is 15
    - 'DP_FFE_PRESET_MAX_LEVEL' equals to 15.
    
    So, the conditional statement is always false and the wrapped code
    never executes.
    
    [HOW]
    Removed lines flagged by Coverity analysis.
    Reviewed-by: default avatarSun peng Li <sunpeng.li@amd.com>
    Acked-by: default avatarZaeem Mohamed <zaeem.mohamed@amd.com>
    Signed-off-by: default avatarIvan Lipski <ivlipski@amd.com>
    Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
    Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
    fe6f61d4
fixpt31_32.c 10.6 KB