summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python
diff options
context:
space:
mode:
authorSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>2026-04-23 18:46:13 +0530
committerAlex Deucher <alexander.deucher@amd.com>2026-04-24 10:52:04 -0400
commit506e047aed6f66b2f8c762125f58316b82076680 (patch)
treea0fa221359ace434c32f5bc091791468d99301b3 /tools/perf/scripts/python
parent5cdc219fe86a1720aa4b5b4f42f11913146e6a93 (diff)
drm/amd/display: Fix divide by zero in calc_psr_num_static_frames
calc_psr_num_static_frames() divides by vsync_rate_hz before checking whether it is zero: frame_time_microsec = 1000000 / vsync_rate_hz; This can trigger a divide-by-zero bug if an invalid refresh rate is passed in. Rewrite the calculation to directly compute the number of frames needed for at least 30 ms using DIV_ROUND_UP(). This avoids the invalid divisor and removes the temporary frame_time_microsec calculation. Keep the existing fallback behavior of 2 static frames when vsync_rate_hz is zero. Fixes: 4cef2ac4c795 ("drm/amd/display: Introduce power module on Linux") Reported-by: Dan Carpenter <error27@gmail.com> Cc: Leo Li <sunpeng.li@amd.com> Cc: Ray Wu <ray.wu@amd.com> Cc: Chenyu Chen <chen-yu.chen@amd.com> Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com> Reviewed-by: Leo Li <sunpeng.li@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions