* [bug report] drm/amd/display: Introduce power module on Linux
@ 2026-04-23 5:21 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2026-04-23 5:21 UTC (permalink / raw)
To: Ray Wu; +Cc: amd-gfx, SHANMUGAM, SRINIVASAN
Hello Ray Wu,
Commit 4cef2ac4c795 ("drm/amd/display: Introduce power module on
Linux") from Feb 27, 2026 (linux-next), leads to the following Smatch
static checker warning:
drivers/gpu/drm/amd/amdgpu/../display/modules/power/power.c:172 calc_psr_num_static_frames()
warn: previously used 'vsync_rate_hz' as divisor (see line 163)
drivers/gpu/drm/amd/amdgpu/../display/modules/power/power.c
158 static unsigned int calc_psr_num_static_frames(unsigned int vsync_rate_hz)
159 {
160 /* Calculate number of static frames before generating interrupt to
161 * enter PSR.
162 */
163 unsigned int frame_time_microsec = 1000000 / vsync_rate_hz;
^^^^^^^^^^^^^
vsync_rate_hz is used as a divisor here
164
165 // Init fail safe of 2 frames static
166 unsigned int num_frames_static = 2;
167
168 /* Round up
169 * Calculate number of frames such that at least 30 ms of time has
170 * passed.
171 */
--> 172 if (vsync_rate_hz != 0)
^^^^^^^^^^^^^^^^^^
If it's zero then we already hit a divide by zero bug and crashed.
173 num_frames_static = (30000 / frame_time_microsec) + 1;
174
175 return num_frames_static;
176 }
This email is a free service from the Smatch-CI project [smatch.sf.net].
regards,
dan carpenter
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-04-23 8:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-23 5:21 [bug report] drm/amd/display: Introduce power module on Linux Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox