drm/amd/display: Introduce power module on Linux
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