drm/amd/display: Check if modulo is 0 before dividing.
[ Upstream commit 49947b906a6bd9668eaf4f9cf691973c25c26955 ] [How & Why] If a value of 0 is read, then this will cause a divide-by-0 panic. Reviewed-by: Martin Leung <Martin.Leung@amd.com> Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com> Signed-off-by: David Galiffi <David.Galiffi@amd.com> Tested-by: Daniel Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
1daf72982e
commit
10ef82d6e0
@@ -1013,9 +1013,12 @@ static bool get_pixel_clk_frequency_100hz(
|
||||
* not be programmed equal to DPREFCLK
|
||||
*/
|
||||
modulo_hz = REG_READ(MODULO[inst]);
|
||||
*pixel_clk_khz = div_u64((uint64_t)clock_hz*
|
||||
clock_source->ctx->dc->clk_mgr->dprefclk_khz*10,
|
||||
modulo_hz);
|
||||
if (modulo_hz)
|
||||
*pixel_clk_khz = div_u64((uint64_t)clock_hz*
|
||||
clock_source->ctx->dc->clk_mgr->dprefclk_khz*10,
|
||||
modulo_hz);
|
||||
else
|
||||
*pixel_clk_khz = 0;
|
||||
} else {
|
||||
/* NOTE: There is agreement with VBIOS here that MODULO is
|
||||
* programmed equal to DPREFCLK, in which case PHASE will be
|
||||
|
||||
Reference in New Issue
Block a user