]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/amd/pm: fix uninitialized variable warning for smu8_hwmgr
authorTim Huang <Tim.Huang@amd.com>
Fri, 26 Apr 2024 04:52:45 +0000 (12:52 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Sep 2024 09:06:39 +0000 (11:06 +0200)
[ Upstream commit 86df36b934640866eb249a4488abb148b985a0d9 ]

Clear warnings that using uninitialized value level when fails
to get the value from SMU.

Signed-off-by: Tim Huang <Tim.Huang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c

index 35d0ff57a59604605d9abace6c78e406753872fa..e85a90b989b5962e444207b0835cd059833931ac 100644 (file)
@@ -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,9 @@ 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 +614,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 +622,9 @@ 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 +644,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 +652,9 @@ 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;