From: Jesse Zhang <jesse.zhang@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: <Alexander.Deucher@amd.com>,
Christian Koenig <christian.koenig@amd.com>, <Tim.Huang@amd.com>,
Jesse Zhang <jesse.zhang@amd.com>,
Jesse Zhang <Jesse.Zhang@amd.com>
Subject: [PATCH] drm/amd/pm: fix the uninitialized scalar variable warning
Date: Tue, 30 Apr 2024 15:14:11 +0800 [thread overview]
Message-ID: <20240430071411.2107891-1-jesse.zhang@amd.com> (raw)
Fix warning for using uninitialized values
sclk_mask, mclk_mask and soc_mask.
v2:Set default variable to UMD PSTATE(Tim Huang)
Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>
---
.../gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c | 32 ++++++++++++++++---
1 file changed, 27 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c
index 8908bbb3ff1f..36a49cfc22e4 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c
@@ -835,10 +835,20 @@ static int renoir_force_clk_levels(struct smu_context *smu,
ret = renoir_get_dpm_clk_limited(smu, clk_type, soft_max_level, &max_freq);
if (ret)
return ret;
- ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_SetSoftMaxSocclkByFreq, max_freq, NULL);
+ /* = 0: min_freq
+ * = 1: UMD_PSTATE_CLK
+ * >= 2: max_freq
+ */
+ ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_SetSoftMaxSocclkByFreq,
+ soft_max_level == 0 ? min_freq :
+ soft_max_level == 1 ? RENOIR_UMD_PSTATE_SOCCLK : max_freq,
+ NULL);
if (ret)
return ret;
- ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_SetHardMinSocclkByFreq, min_freq, NULL);
+ ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_SetHardMinSocclkByFreq,
+ soft_min_level == 0 ? min_freq :
+ soft_min_level == 1 ? RENOIR_UMD_PSTATE_SOCCLK : max_freq,
+ NULL);
if (ret)
return ret;
break;
@@ -850,10 +860,21 @@ static int renoir_force_clk_levels(struct smu_context *smu,
ret = renoir_get_dpm_clk_limited(smu, clk_type, soft_max_level, &max_freq);
if (ret)
return ret;
- ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_SetSoftMaxFclkByFreq, max_freq, NULL);
+ /* mclk levels are in reverse order
+ * = 0: max_freq
+ * = 1: UMD_PSTATE_CLK
+ * >= 2: min_freq
+ */
+ ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_SetSoftMaxFclkByFreq,
+ soft_max_level >= 2 ? min_freq :
+ soft_max_level == 1 ? RENOIR_UMD_PSTATE_FCLK : max_freq,
+ NULL);
if (ret)
return ret;
- ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_SetHardMinFclkByFreq, min_freq, NULL);
+ ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_SetHardMinFclkByFreq,
+ soft_min_level >= 2 ? min_freq :
+ soft_min_level == 1 ? RENOIR_UMD_PSTATE_SOCCLK : max_freq,
+ NULL);
if (ret)
return ret;
break;
@@ -932,7 +953,8 @@ static int renoir_set_performance_level(struct smu_context *smu,
enum amd_dpm_forced_level level)
{
int ret = 0;
- uint32_t sclk_mask, mclk_mask, soc_mask;
+ /* default mask is UMD PSTATE CLK */
+ uint32_t sclk_mask = 1, mclk_mask = 1, soc_mask = 1;
switch (level) {
case AMD_DPM_FORCED_LEVEL_HIGH:
--
2.25.1
next reply other threads:[~2024-04-30 7:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-30 7:14 Jesse Zhang [this message]
2024-05-06 6:20 ` [PATCH] drm/amd/pm: fix the uninitialized scalar variable warning Zhang, Jesse(Jie)
2024-05-06 6:33 ` Wang, Yang(Kevin)
2024-05-07 2:32 ` Huang, Tim
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=20240430071411.2107891-1-jesse.zhang@amd.com \
--to=jesse.zhang@amd.com \
--cc=Alexander.Deucher@amd.com \
--cc=Tim.Huang@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).