[bug report] drm/amd/pm: Update dpm table structs for smu_v15_0

Dan Carpenter <[email protected]> Sat, 8 Aug 2026 22:41:35 +0300
Newsgroups org.freedesktop.lists.amd-gfx
Message-ID <[email protected]>
Hello Asad Kamal,

Commit f7bee962d92a ("drm/amd/pm: Update dpm table structs for
smu_v15_0") from Dec 23, 2025 (linux-next), leads to the following
Smatch static checker warning:

    drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu15/smu_v15_0.c:1270
    smu_v15_0_set_single_dpm_table() error: uninitialized symbol 'is_fine_grained'.

    drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu15/smu_v15_0.c:1283
    smu_v15_0_set_single_dpm_table() error: uninitialized symbol 'clk'.

drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu15/smu_v15_0.c
    1245 int smu_v15_0_set_single_dpm_table(struct smu_context *smu,
    1246                                    enum smu_clk_type clk_type,
    1247                                    struct smu_dpm_table *single_dpm_table)
    1248 {
    1249         int ret = 0;
    1250         uint32_t clk;
    1251         bool is_fine_grained;
    1252         int i;
    1253 
    1254         ret = smu_v15_0_get_dpm_level_count(smu,
    1255                                             clk_type,
    1256                                             &single_dpm_table->count);
    1257         if (ret) {
    1258                 dev_err(smu->adev->dev, "[%s] failed to get dpm levels!\n", __func__);
    1259                 return ret;
    1260         }
    1261 
    1262         ret = smu_v15_0_get_fine_grained_status(smu,
    1263                                                 clk_type,
    1264                                                 &is_fine_grained);

is_fine_grained is not set if smu_cmn_clk_dpm_is_enabled().  And we can't
know if it's true since smu_v15_0_set_single_dpm_table() is unused and
we can't tell how it's called.

    1265         if (ret) {
    1266                 dev_err(smu->adev->dev, "[%s] failed to get fine grained status!\n", __func__);
    1267                 return ret;
    1268         }
    1269 
--> 1270         if (is_fine_grained)
    1271                 single_dpm_table->flags |= SMU_DPM_TABLE_FINE_GRAINED;
    1272 
    1273         for (i = 0; i < single_dpm_table->count; i++) {
    1274                 ret = smu_v15_0_get_dpm_freq_by_index(smu,
    1275                                                       clk_type,
    1276                                                       i,
    1277                                                       &clk);
    1278                 if (ret) {
    1279                         dev_err(smu->adev->dev, "[%s] failed to get dpm freq by index!\n", __func__);
    1280                         return ret;
    1281                 }
    1282 
    1283                 single_dpm_table->dpm_levels[i].value = clk;
    1284                 single_dpm_table->dpm_levels[i].enabled = true;
    1285         }
    1286 
    1287         return 0;
    1288 }

This email is a free service from the Smatch-CI project [smatch.sf.net].

regards,
dan carpenter