drm/amd/pm: fix uninitialized variable warning for smu8_hwmgr
Subsystems (3)
PATCH 1/1 drm/amd/pm: fix uninitialized variable warning for smu8_hwmgr
Clear warnings that using uninitialized value level when fails to get the value from SMU.
--- .../drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c +15 -3
@@ -584,6 +584,7 @@ static int smu8_init_uvd_limit(struct pp_hwmgr *hwmgr) hwmgr->dyn_state.uvd_clock_voltage_dependency_table;unsigned long clock =0 ;uint32_t level; +int ret;if (NULL == table || table->count <=0 )return -EINVAL ;
@@ -591,7 +592,10 @@ static int smu8_init_uvd_limit(struct pp_hwmgr *hwmgr) data->uvd_dpm.soft_min_clk =0 ; data->uvd_dpm.hard_min_clk =0 ; -smum_send_msg_to_smc (hwmgr, PPSMC_MSG_GetMaxUvdLevel, &level); + ret =smum_send_msg_to_smc (hwmgr, PPSMC_MSG_GetMaxUvdLevel, &level); + +if (ret) +return ret;if (level < table->count) clock = table->entries[level].vclk;
@@ -611,6 +615,7 @@ static int smu8_init_vce_limit(struct pp_hwmgr *hwmgr) hwmgr->dyn_state.vce_clock_voltage_dependency_table;unsigned long clock =0 ;uint32_t level; +int ret;if (NULL == table || table->count <=0 )return -EINVAL ;
@@ -618,7 +623,10 @@ static int smu8_init_vce_limit(struct pp_hwmgr *hwmgr) data->vce_dpm.soft_min_clk =0 ; data->vce_dpm.hard_min_clk =0 ; -smum_send_msg_to_smc (hwmgr, PPSMC_MSG_GetMaxEclkLevel, &level); + ret =smum_send_msg_to_smc (hwmgr, PPSMC_MSG_GetMaxEclkLevel, &level); + +if (ret) +return ret;if (level < table->count) clock = table->entries[level].ecclk;
@@ -638,6 +646,7 @@ static int smu8_init_acp_limit(struct pp_hwmgr *hwmgr) hwmgr->dyn_state.acp_clock_voltage_dependency_table;unsigned long clock =0 ;uint32_t level; +int ret;if (NULL == table || table->count <=0 )return -EINVAL ;
@@ -645,7 +654,10 @@ static int smu8_init_acp_limit(struct pp_hwmgr *hwmgr) data->acp_dpm.soft_min_clk =0 ; data->acp_dpm.hard_min_clk =0 ; -smum_send_msg_to_smc (hwmgr, PPSMC_MSG_GetMaxAclkLevel, &level); + ret =smum_send_msg_to_smc (hwmgr, PPSMC_MSG_GetMaxAclkLevel, &level); + +if (ret) +return ret;if (level < table->count) clock = table->entries[level].acpclk;
Signature · 1 line
2.39.2
Am 26.04.24 um 11:29 schrieb Tim Huang:
Quoted 4 lines
Clear warnings that using uninitialized value level when fails to get the value from SMU.
Signed-off-by Tim Huang <[email protected]>
Maybe drop the blank line before the "if (ret)", apart from that Reviewed-by: Christian König <[email protected]>
Quoted 68 lines
--- .../drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c +15
-3@@ -584,6 +584,7 @@ static int smu8_init_uvd_limit(struct pp_hwmgr *hwmgr) hwmgr->dyn_state.uvd_clock_voltage_dependency_table;unsigned long clock =0 ;uint32_t level; +int ret;if (NULL == table || table->count <=0 )return -EINVAL ;@@ -591,7 +592,10 @@ static int smu8_init_uvd_limit(struct pp_hwmgr *hwmgr) data->uvd_dpm.soft_min_clk =0 ; data->uvd_dpm.hard_min_clk =0 ; -smum_send_msg_to_smc (hwmgr, PPSMC_MSG_GetMaxUvdLevel, &level); + ret =smum_send_msg_to_smc (hwmgr, PPSMC_MSG_GetMaxUvdLevel, &level); + +if (ret) +return ret;if (level < table->count) clock = table->entries[level].vclk;@@ -611,6 +615,7 @@ static int smu8_init_vce_limit(struct pp_hwmgr *hwmgr) hwmgr->dyn_state.vce_clock_voltage_dependency_table;unsigned long clock =0 ;uint32_t level; +int ret;if (NULL == table || table->count <=0 )return -EINVAL ;@@ -618,7 +623,10 @@ static int smu8_init_vce_limit(struct pp_hwmgr *hwmgr) data->vce_dpm.soft_min_clk =0 ; data->vce_dpm.hard_min_clk =0 ; -smum_send_msg_to_smc (hwmgr, PPSMC_MSG_GetMaxEclkLevel, &level); + ret =smum_send_msg_to_smc (hwmgr, PPSMC_MSG_GetMaxEclkLevel, &level); + +if (ret) +return ret;if (level < table->count) clock = table->entries[level].ecclk;@@ -638,6 +646,7 @@ static int smu8_init_acp_limit(struct pp_hwmgr *hwmgr) hwmgr->dyn_state.acp_clock_voltage_dependency_table;unsigned long clock =0 ;uint32_t level; +int ret;if (NULL == table || table->count <=0 )return -EINVAL ;@@ -645,7 +654,10 @@ static int smu8_init_acp_limit(struct pp_hwmgr *hwmgr) data->acp_dpm.soft_min_clk =0 ; data->acp_dpm.hard_min_clk =0 ; -smum_send_msg_to_smc (hwmgr, PPSMC_MSG_GetMaxAclkLevel, &level); + ret =smum_send_msg_to_smc (hwmgr, PPSMC_MSG_GetMaxAclkLevel, &level); + +if (ret) +return ret;if (level < table->count) clock = table->entries[level].acpclk;
[AMD Official Use Only - General]
-----Original Message-----
From: Christian König <[email protected]>
Sent: Friday, April 26, 2024 7:39 PM
To: Huang, Tim <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>
Subject: Re: [PATCH] drm/amd/pm: fix uninitialized variable warning for smu8_hwmgr
Am 26.04.24 um 11:29 schrieb Tim Huang:
Quoted 6 lines
Clear warnings that using uninitialized value level when fails to get the value from SMU.
Signed-off-by Tim Huang <[email protected]>Maybe drop the blank line before the "if (ret)", apart from that
Yes, will drop it. Thanks.
Tim
Quoted 73 lines
Reviewed-by Christian König <[email protected]>--- .../drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c +5
-1@@ -584,6 +584,7 @@ static int smu8_init_uvd_limit(struct pp_hwmgr *hwmgr) hwmgr->dyn_state.uvd_clock_voltage_dependency_table;unsigned long clock =0 ;uint32_t level; +int ret;if (NULL == table || table->count <=0 )return -EINVAL ;@@ -591,7 +592,10 @@ static int smu8_init_uvd_limit(struct pp_hwmgr *hwmgr) data->uvd_dpm.soft_min_clk =0 ; data->uvd_dpm.hard_min_clk =0 ; -smum_send_msg_to_smc (hwmgr, PPSMC_MSG_GetMaxUvdLevel, &level); + ret =smum_send_msg_to_smc (hwmgr, PPSMC_MSG_GetMaxUvdLevel, &level); + +if (ret) +return ret;if (level < table->count) clock = table->entries[level].vclk; @@ -611,6 +615,7 @@ static int
smu8_init_vce_limit(struct pp_hwmgr *hwmgr)hwmgr->dyn_state.vce_clock_voltage_dependency_table; unsigned long clock = 0; uint32_t level;drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c +6
-1+int ret;if (NULL == table || table->count <=0 )return -EINVAL ;@@ -618,7 +623,10 @@ static int smu8_init_vce_limit(struct pp_hwmgr *hwmgr) data->vce_dpm.soft_min_clk =0 ; data->vce_dpm.hard_min_clk =0 ; -smum_send_msg_to_smc (hwmgr, PPSMC_MSG_GetMaxEclkLevel, &level); + ret =smum_send_msg_to_smc (hwmgr, PPSMC_MSG_GetMaxEclkLevel, +&level); + +if (ret) +return ret;if (level < table->count) clock = table->entries[level].ecclk; @@ -638,6 +646,7 @@ staticint
smu8_init_acp_limit(struct pp_hwmgr *hwmgr)hwmgr->dyn_state.acp_clock_voltage_dependency_table; unsigned long clock = 0; uint32_t level;drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c +6
-1+int ret;if (NULL == table || table->count <=0 )return -EINVAL ;@@ -645,7 +654,10 @@ static int smu8_init_acp_limit(struct pp_hwmgr *hwmgr) data->acp_dpm.soft_min_clk =0 ; data->acp_dpm.hard_min_clk =0 ; -smum_send_msg_to_smc (hwmgr, PPSMC_MSG_GetMaxAclkLevel, &level); + ret =smum_send_msg_to_smc (hwmgr, PPSMC_MSG_GetMaxAclkLevel, +&level); + +if (ret) +return ret;if (level < table->count) clock = table->entries[level].acpclk;