From: Dan Carpenter <error27@gmail.com>
To: Ray Wu <ray.wu@amd.com>
Cc: amd-gfx@lists.freedesktop.org, "SHANMUGAM,
SRINIVASAN" <SRINIVASAN.SHANMUGAM@amd.com>
Subject: [bug report] drm/amd/display: Introduce power module on Linux
Date: Thu, 23 Apr 2026 08:21:44 +0300 [thread overview]
Message-ID: <aemsaAK-kuQ6fyl8@stanley.mountain> (raw)
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
reply other threads:[~2026-04-23 8:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aemsaAK-kuQ6fyl8@stanley.mountain \
--to=error27@gmail.com \
--cc=SRINIVASAN.SHANMUGAM@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=ray.wu@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox