• Srinivasan Shanmugam's avatar
    drm/amd/display: Fix possible use of uninitialized 'max_chunks_fbc_mode' in 'calculate_bandwidth()' · 88c6d84d
    Srinivasan Shanmugam authored
    'max_chunks_fbc_mode' is only declared and assigned a value under a
    specific condition in the following lines:
    
    if (data->fbc_en[i] == 1) {
    	max_chunks_fbc_mode = 128 - dmif_chunk_buff_margin;
    }
    
    If 'data->fbc_en[i]' is not equal to 1 for any i, max_chunks_fbc_mode
    will not be initialized if it's used outside of this for loop.
    
    Ensure that 'max_chunks_fbc_mode' is properly initialized before it's
    used. Initialize it to a default value right after its declaration to
    ensure that it gets a value assigned under all possible control flow
    paths.
    
    Thus fixing the below:
    drivers/gpu/drm/amd/amdgpu/../display/dc/basics/dce_calcs.c:914 calculate_bandwidth() error: uninitialized symbol 'max_chunks_fbc_mode'.
    drivers/gpu/drm/amd/amdgpu/../display/dc/basics/dce_calcs.c:917 calculate_bandwidth() error: uninitialized symbol 'max_chunks_fbc_mode'.
    
    Fixes: 4562236b ("drm/amd/dc: Add dc display driver (v2)")
    Cc: Harry Wentland <harry.wentland@amd.com>
    Cc: Alex Deucher <alexander.deucher@amd.com>
    Cc: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
    Cc: Aurabindo Pillai <aurabindo.pillai@amd.com>
    Signed-off-by: default avatarSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>
    Reviewed-by: default avatarRoman Li <roman.li@amd.com>
    Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
    88c6d84d
dce_calcs.c 209 KB