Skip to content

Commit

Permalink
drm/amd/display: avoid divided by zero
Browse files Browse the repository at this point in the history
[why]
insert divided by zero protection

Reviewed-by: Alvin Lee <alvin.lee2@amd.com>
Signed-off-by: Charlene Liu <Charlene.Liu@amd.com>
Signed-off-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
  • Loading branch information
Charlene Liu authored and Alex Deucher committed Nov 4, 2024
1 parent d29bd94 commit d1fd30e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/gpu/drm/amd/display/modules/freesync/freesync.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ unsigned int mod_freesync_calc_v_total_from_refresh(
unsigned int v_total;
unsigned int frame_duration_in_ns;

if (refresh_in_uhz == 0)
return stream->timing.v_total;

frame_duration_in_ns =
((unsigned int)(div64_u64((1000000000ULL * 1000000),
refresh_in_uhz)));
Expand Down

0 comments on commit d1fd30e

Please sign in to comment.