]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amdgpu/pm: Check the return value of smum_send_msg_to_smc
authorMa Jun <Jun.Ma2@amd.com>
Fri, 26 Apr 2024 06:38:04 +0000 (14:38 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 30 Apr 2024 13:59:20 +0000 (09:59 -0400)
Check the return value of smum_send_msg_to_smc, otherwise
we might use an uninitialized variable "now"

Signed-off-by: Ma Jun <Jun.Ma2@amd.com>
Reviewed-by: Tim Huang <Tim.Huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c

index 02ba68d7c6546b3bc4d3db4993bd816e9835592c..0b181bc8931c8c26d09ddb6cfa2dfc1d46ed2bcd 100644 (file)
@@ -1036,7 +1036,9 @@ static int smu10_print_clock_levels(struct pp_hwmgr *hwmgr,
 
        switch (type) {
        case PP_SCLK:
-               smum_send_msg_to_smc(hwmgr, PPSMC_MSG_GetGfxclkFrequency, &now);
+               ret = smum_send_msg_to_smc(hwmgr, PPSMC_MSG_GetGfxclkFrequency, &now);
+               if (ret)
+                       return ret;
 
        /* driver only know min/max gfx_clk, Add level 1 for all other gfx clks */
                if (now == data->gfx_max_freq_limit/100)
@@ -1057,7 +1059,9 @@ static int smu10_print_clock_levels(struct pp_hwmgr *hwmgr,
                                        i == 2 ? "*" : "");
                break;
        case PP_MCLK:
-               smum_send_msg_to_smc(hwmgr, PPSMC_MSG_GetFclkFrequency, &now);
+               ret = smum_send_msg_to_smc(hwmgr, PPSMC_MSG_GetFclkFrequency, &now);
+               if (ret)
+                       return ret;
 
                for (i = 0; i < mclk_table->count; i++)
                        size += sprintf(buf + size, "%d: %uMhz %s\n",