From: Dan Carpenter <dan.carpenter@linaro.org>
To: Jack Chang <jack.chang@amd.com>
Cc: amd-gfx@lists.freedesktop.org, "SHANMUGAM,
SRINIVASAN" <SRINIVASAN.SHANMUGAM@amd.com>
Subject: [bug report] drm/amd/display: Refactor panel replay set dmub cmd flow
Date: Wed, 10 Dec 2025 09:07:27 +0300 [thread overview]
Message-ID: <aTkOH9pNfVCtNIR8@stanley.mountain> (raw)
Hello Jack Chang,
Commit 74ce00932e7e ("drm/amd/display: Refactor panel replay set dmub
cmd flow") from Sep 3, 2025 (linux-next), leads to the following
Smatch static checker warning:
drivers/gpu/drm/amd/amdgpu/../display/dc/link/protocols/link_edp_panel_control.c:1459 edp_pr_get_state()
warn: passing casted pointer 'state' to 'dc_wake_and_execute_gpint()' 64 vs 32.
drivers/gpu/drm/amd/amdgpu/../display/dc/link/protocols/link_edp_panel_control.c
1448 bool edp_pr_get_state(const struct dc_link *link, uint64_t *state)
^^^^^^^^^^^^^^^
1449 {
1450 const struct dc *dc = link->ctx->dc;
1451 unsigned int panel_inst = 0;
1452 uint32_t retry_count = 0;
1453
1454 if (!dc_get_edp_link_panel_inst(dc, link, &panel_inst))
1455 return false;
1456
1457 do {
1458 // Send gpint command and wait for ack
--> 1459 if (!dc_wake_and_execute_gpint(dc->ctx, DMUB_GPINT__GET_REPLAY_STATE, panel_inst,
1460 (uint32_t *)state, DM_DMUB_WAIT_TYPE_WAIT_WITH_REPLY)) {
^^^^^^^^^^^^^^^^^
The dc_wake_and_execute_gpint() function doesn't take a u64, it takes
a u32. It tries to initialize the state to zero at the start but
that's not going to work because of the type mismatch. It suggests
that callers are allowed to pass uninitialized data to
edp_pr_get_state() but at present there are no callers so this is
only a bug in the code but doesn't affect runtime.
1461 // Return invalid state when GPINT times out
1462 *state = PR_STATE_INVALID;
1463 }
1464 } while (++retry_count <= 1000 && *state == PR_STATE_INVALID);
1465
1466 // Assert if max retry hit
1467 if (retry_count >= 1000 && *state == PR_STATE_INVALID) {
1468 ASSERT(0);
1469 /* To-do: Add retry fail log */
1470 }
1471
1472 return true;
1473 }
regards,
dan carpenter
reply other threads:[~2025-12-10 9:16 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=aTkOH9pNfVCtNIR8@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=SRINIVASAN.SHANMUGAM@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=jack.chang@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