]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/amd/pm: fix warning using uninitialized value of max_vid_step
authorJesse Zhang <jesse.zhang@amd.com>
Mon, 29 Apr 2024 07:26:25 +0000 (15:26 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 30 Apr 2024 14:00:09 +0000 (10:00 -0400)
Check the return of pp_atomfwctrl_get_Voltage_table_v4
as it may fail to initialize max_vid_step
V2: change the check condition (Tim Huang)

Signed-off-by: Jesse Zhang <Jesse.Zhang@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/vega10_hwmgr.c

index b602059436a8c73170e579640a1b447015a1b3e9..d004cdbe97b4e6064fee1de53f1999e2338b4ed5 100644 (file)
@@ -2573,8 +2573,11 @@ static int vega10_init_smc_table(struct pp_hwmgr *hwmgr)
                }
        }
 
-       pp_atomfwctrl_get_voltage_table_v4(hwmgr, VOLTAGE_TYPE_VDDC,
+       result = pp_atomfwctrl_get_voltage_table_v4(hwmgr, VOLTAGE_TYPE_VDDC,
                        VOLTAGE_OBJ_SVID2,  &voltage_table);
+       PP_ASSERT_WITH_CODE(!result,
+                       "Failed to get voltage table!",
+                       return result);
        pp_table->MaxVidStep = voltage_table.max_vid_step;
 
        pp_table->GfxDpmVoltageMode =