[PATCH 02/17] drm/amd/display: avoid divided by zero
Zaeem Mohamed
zaeem.mohamed at amd.com
Fri Nov 1 13:49:25 UTC 2024
From: Charlene Liu <Charlene.Liu at amd.com>
[why]
insert divided by zero protection
Reviewed-by: Alvin Lee <alvin.lee2 at amd.com>
Signed-off-by: Charlene Liu <Charlene.Liu at amd.com>
Signed-off-by: Zaeem Mohamed <zaeem.mohamed at amd.com>
---
drivers/gpu/drm/amd/display/modules/freesync/freesync.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
index fc4268729017..f980a84dceef 100644
--- a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
+++ b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
@@ -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)));
--
2.34.1
More information about the amd-gfx
mailing list