drm/amdgpu/pm: Fix uninitialized variable warning for smu10
[ Upstream commit 336c8f558d596699d3d9814a45600139b2f23f27 ] Check return value of smum_send_msg_to_smc to fix uninitialized variable varning Signed-off-by: Ma Jun <Jun.Ma2@amd.com> Acked-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Yang Wang <kevinyang.wang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Родитель
e55e3904ff
Коммит
80ce7edcd4
|
@ -1551,7 +1551,10 @@ static int smu10_set_fine_grain_clk_vol(struct pp_hwmgr *hwmgr,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (input[0] == 0) {
|
if (input[0] == 0) {
|
||||||
smum_send_msg_to_smc(hwmgr, PPSMC_MSG_GetMinGfxclkFrequency, &min_freq);
|
ret = smum_send_msg_to_smc(hwmgr, PPSMC_MSG_GetMinGfxclkFrequency, &min_freq);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
if (input[1] < min_freq) {
|
if (input[1] < min_freq) {
|
||||||
pr_err("Fine grain setting minimum sclk (%ld) MHz is less than the minimum allowed (%d) MHz\n",
|
pr_err("Fine grain setting minimum sclk (%ld) MHz is less than the minimum allowed (%d) MHz\n",
|
||||||
input[1], min_freq);
|
input[1], min_freq);
|
||||||
|
@ -1559,7 +1562,10 @@ static int smu10_set_fine_grain_clk_vol(struct pp_hwmgr *hwmgr,
|
||||||
}
|
}
|
||||||
smu10_data->gfx_actual_soft_min_freq = input[1];
|
smu10_data->gfx_actual_soft_min_freq = input[1];
|
||||||
} else if (input[0] == 1) {
|
} else if (input[0] == 1) {
|
||||||
smum_send_msg_to_smc(hwmgr, PPSMC_MSG_GetMaxGfxclkFrequency, &max_freq);
|
ret = smum_send_msg_to_smc(hwmgr, PPSMC_MSG_GetMaxGfxclkFrequency, &max_freq);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
if (input[1] > max_freq) {
|
if (input[1] > max_freq) {
|
||||||
pr_err("Fine grain setting maximum sclk (%ld) MHz is greater than the maximum allowed (%d) MHz\n",
|
pr_err("Fine grain setting maximum sclk (%ld) MHz is greater than the maximum allowed (%d) MHz\n",
|
||||||
input[1], max_freq);
|
input[1], max_freq);
|
||||||
|
@ -1574,10 +1580,15 @@ static int smu10_set_fine_grain_clk_vol(struct pp_hwmgr *hwmgr,
|
||||||
pr_err("Input parameter number not correct\n");
|
pr_err("Input parameter number not correct\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
smum_send_msg_to_smc(hwmgr, PPSMC_MSG_GetMinGfxclkFrequency, &min_freq);
|
ret = smum_send_msg_to_smc(hwmgr, PPSMC_MSG_GetMinGfxclkFrequency, &min_freq);
|
||||||
smum_send_msg_to_smc(hwmgr, PPSMC_MSG_GetMaxGfxclkFrequency, &max_freq);
|
if (ret)
|
||||||
|
return ret;
|
||||||
smu10_data->gfx_actual_soft_min_freq = min_freq;
|
smu10_data->gfx_actual_soft_min_freq = min_freq;
|
||||||
|
|
||||||
|
ret = smum_send_msg_to_smc(hwmgr, PPSMC_MSG_GetMaxGfxclkFrequency, &max_freq);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
smu10_data->gfx_actual_soft_max_freq = max_freq;
|
smu10_data->gfx_actual_soft_max_freq = max_freq;
|
||||||
} else if (type == PP_OD_COMMIT_DPM_TABLE) {
|
} else if (type == PP_OD_COMMIT_DPM_TABLE) {
|
||||||
if (size != 0) {
|
if (size != 0) {
|
||||||
|
|
|
@ -294,12 +294,12 @@ static int vega12_set_features_platform_caps(struct pp_hwmgr *hwmgr)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void vega12_init_dpm_defaults(struct pp_hwmgr *hwmgr)
|
static int vega12_init_dpm_defaults(struct pp_hwmgr *hwmgr)
|
||||||
{
|
{
|
||||||
struct vega12_hwmgr *data = (struct vega12_hwmgr *)(hwmgr->backend);
|
struct vega12_hwmgr *data = (struct vega12_hwmgr *)(hwmgr->backend);
|
||||||
struct amdgpu_device *adev = hwmgr->adev;
|
struct amdgpu_device *adev = hwmgr->adev;
|
||||||
uint32_t top32, bottom32;
|
uint32_t top32, bottom32;
|
||||||
int i;
|
int i, ret;
|
||||||
|
|
||||||
data->smu_features[GNLD_DPM_PREFETCHER].smu_feature_id =
|
data->smu_features[GNLD_DPM_PREFETCHER].smu_feature_id =
|
||||||
FEATURE_DPM_PREFETCHER_BIT;
|
FEATURE_DPM_PREFETCHER_BIT;
|
||||||
|
@ -365,10 +365,16 @@ static void vega12_init_dpm_defaults(struct pp_hwmgr *hwmgr)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the SN to turn into a Unique ID */
|
/* Get the SN to turn into a Unique ID */
|
||||||
smum_send_msg_to_smc(hwmgr, PPSMC_MSG_ReadSerialNumTop32, &top32);
|
ret = smum_send_msg_to_smc(hwmgr, PPSMC_MSG_ReadSerialNumTop32, &top32);
|
||||||
smum_send_msg_to_smc(hwmgr, PPSMC_MSG_ReadSerialNumBottom32, &bottom32);
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
ret = smum_send_msg_to_smc(hwmgr, PPSMC_MSG_ReadSerialNumBottom32, &bottom32);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
adev->unique_id = ((uint64_t)bottom32 << 32) | top32;
|
adev->unique_id = ((uint64_t)bottom32 << 32) | top32;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vega12_set_private_data_based_on_pptable(struct pp_hwmgr *hwmgr)
|
static int vega12_set_private_data_based_on_pptable(struct pp_hwmgr *hwmgr)
|
||||||
|
@ -411,7 +417,11 @@ static int vega12_hwmgr_backend_init(struct pp_hwmgr *hwmgr)
|
||||||
|
|
||||||
vega12_set_features_platform_caps(hwmgr);
|
vega12_set_features_platform_caps(hwmgr);
|
||||||
|
|
||||||
vega12_init_dpm_defaults(hwmgr);
|
result = vega12_init_dpm_defaults(hwmgr);
|
||||||
|
if (result) {
|
||||||
|
pr_err("%s failed\n", __func__);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/* Parse pptable data read from VBIOS */
|
/* Parse pptable data read from VBIOS */
|
||||||
vega12_set_private_data_based_on_pptable(hwmgr);
|
vega12_set_private_data_based_on_pptable(hwmgr);
|
||||||
|
|
|
@ -329,12 +329,12 @@ static int vega20_set_features_platform_caps(struct pp_hwmgr *hwmgr)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void vega20_init_dpm_defaults(struct pp_hwmgr *hwmgr)
|
static int vega20_init_dpm_defaults(struct pp_hwmgr *hwmgr)
|
||||||
{
|
{
|
||||||
struct vega20_hwmgr *data = (struct vega20_hwmgr *)(hwmgr->backend);
|
struct vega20_hwmgr *data = (struct vega20_hwmgr *)(hwmgr->backend);
|
||||||
struct amdgpu_device *adev = hwmgr->adev;
|
struct amdgpu_device *adev = hwmgr->adev;
|
||||||
uint32_t top32, bottom32;
|
uint32_t top32, bottom32;
|
||||||
int i;
|
int i, ret;
|
||||||
|
|
||||||
data->smu_features[GNLD_DPM_PREFETCHER].smu_feature_id =
|
data->smu_features[GNLD_DPM_PREFETCHER].smu_feature_id =
|
||||||
FEATURE_DPM_PREFETCHER_BIT;
|
FEATURE_DPM_PREFETCHER_BIT;
|
||||||
|
@ -405,10 +405,17 @@ static void vega20_init_dpm_defaults(struct pp_hwmgr *hwmgr)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the SN to turn into a Unique ID */
|
/* Get the SN to turn into a Unique ID */
|
||||||
smum_send_msg_to_smc(hwmgr, PPSMC_MSG_ReadSerialNumTop32, &top32);
|
ret = smum_send_msg_to_smc(hwmgr, PPSMC_MSG_ReadSerialNumTop32, &top32);
|
||||||
smum_send_msg_to_smc(hwmgr, PPSMC_MSG_ReadSerialNumBottom32, &bottom32);
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
ret = smum_send_msg_to_smc(hwmgr, PPSMC_MSG_ReadSerialNumBottom32, &bottom32);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
adev->unique_id = ((uint64_t)bottom32 << 32) | top32;
|
adev->unique_id = ((uint64_t)bottom32 << 32) | top32;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vega20_set_private_data_based_on_pptable(struct pp_hwmgr *hwmgr)
|
static int vega20_set_private_data_based_on_pptable(struct pp_hwmgr *hwmgr)
|
||||||
|
@ -428,6 +435,7 @@ static int vega20_hwmgr_backend_init(struct pp_hwmgr *hwmgr)
|
||||||
{
|
{
|
||||||
struct vega20_hwmgr *data;
|
struct vega20_hwmgr *data;
|
||||||
struct amdgpu_device *adev = hwmgr->adev;
|
struct amdgpu_device *adev = hwmgr->adev;
|
||||||
|
int result;
|
||||||
|
|
||||||
data = kzalloc(sizeof(struct vega20_hwmgr), GFP_KERNEL);
|
data = kzalloc(sizeof(struct vega20_hwmgr), GFP_KERNEL);
|
||||||
if (data == NULL)
|
if (data == NULL)
|
||||||
|
@ -453,8 +461,11 @@ static int vega20_hwmgr_backend_init(struct pp_hwmgr *hwmgr)
|
||||||
|
|
||||||
vega20_set_features_platform_caps(hwmgr);
|
vega20_set_features_platform_caps(hwmgr);
|
||||||
|
|
||||||
vega20_init_dpm_defaults(hwmgr);
|
result = vega20_init_dpm_defaults(hwmgr);
|
||||||
|
if (result) {
|
||||||
|
pr_err("%s failed\n", __func__);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
/* Parse pptable data read from VBIOS */
|
/* Parse pptable data read from VBIOS */
|
||||||
vega20_set_private_data_based_on_pptable(hwmgr);
|
vega20_set_private_data_based_on_pptable(hwmgr);
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче