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

drm/amd/display: Set initial value to a divider

[why/how]
Due to compiler optimization the values would be
passed to the division function uninitialized
causing a div by zero. Initialize the numerator
and denominator to 0 and 1 to prevent division
by zero.

Signed-off-by: Mikita Lipski <mikita.lipski@amd.com>
Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Mikita Lipski and committed by
Alex Deucher
8532467c 712343cd

+2 -2
+2 -2
drivers/gpu/drm/amd/display/dc/core/dc_link.c
··· 2891 2891 static struct fixed31_32 get_pbn_from_bw_in_kbps(uint64_t kbps) 2892 2892 { 2893 2893 struct fixed31_32 peak_kbps; 2894 - uint32_t numerator; 2895 - uint32_t denominator; 2894 + uint32_t numerator = 0; 2895 + uint32_t denominator = 1; 2896 2896 2897 2897 /* 2898 2898 * margin 5300ppm + 300ppm ~ 0.6% as per spec, factor is 1.006