[PATCH 3/3] drm/amd/pm: fix the uninitialized scalar variable warning

Jesse Zhang jesse.zhang at amd.com
Fri Apr 26 07:29:13 UTC 2024


Fix warning for using uninitialized values ​​sclk_mask, mck_mask and soc_mask.

Signed-off-by: Jesse Zhang <Jesse.Zhang at amd.com>
---
 drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 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..10f673b651a0 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c
@@ -932,7 +932,7 @@ 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;
+	uint32_t sclk_mask, mclk_mask, soc_mask = 0;
 
 	switch (level) {
 	case AMD_DPM_FORCED_LEVEL_HIGH:
@@ -1018,8 +1018,10 @@ static int renoir_set_performance_level(struct smu_context *smu,
 						    &soc_mask);
 		if (ret)
 			return ret;
-		renoir_force_clk_levels(smu, SMU_SCLK, 1 << sclk_mask);
-		renoir_force_clk_levels(smu, SMU_MCLK, 1 << mclk_mask);
+		if (level == AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK)
+			renoir_force_clk_levels(smu, SMU_SCLK, 1 << sclk_mask);
+		else
+			renoir_force_clk_levels(smu, SMU_MCLK, 1 << mclk_mask);
 		renoir_force_clk_levels(smu, SMU_SOCCLK, 1 << soc_mask);
 		break;
 	case AMD_DPM_FORCED_LEVEL_PROFILE_PEAK:
-- 
2.25.1



More information about the amd-gfx mailing list