From: Charlene Liu <[email protected]>

[why]
insert divided by zero protection

Reviewed-by: Alvin Lee <[email protected]>
Signed-off-by: Charlene Liu <[email protected]>
Signed-off-by: Zaeem Mohamed <[email protected]>
---
 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

Reply via email to