[bug report] drm/amd/powerplay: implement smc firmware v2.1 for smu11
Dan Carpenter
dan.carpenter at oracle.com
Mon Aug 19 13:03:58 UTC 2019
Hello Kevin Wang,
The patch b55c83a7438d: "drm/amd/powerplay: implement smc firmware
v2.1 for smu11" from Jun 21, 2019, leads to the following static
checker warning:
drivers/gpu/drm/amd/amdgpu/../powerplay/smu_v11_0.c:390 smu_v11_0_setup_pptable()
warn: passing casted pointer '&size' to 'smu_get_atom_data_table()' 32 vs 16.
drivers/gpu/drm/amd/amdgpu/../powerplay/smu_v11_0.c
357 static int smu_v11_0_setup_pptable(struct smu_context *smu)
358 {
359 struct amdgpu_device *adev = smu->adev;
360 const struct smc_firmware_header_v1_0 *hdr;
361 int ret, index;
362 uint32_t size;
^^^^^^^^^^^^^
363 uint8_t frev, crev;
364 void *table;
365 uint16_t version_major, version_minor;
366
367 hdr = (const struct smc_firmware_header_v1_0 *) adev->pm.fw->data;
368 version_major = le16_to_cpu(hdr->header.header_version_major);
369 version_minor = le16_to_cpu(hdr->header.header_version_minor);
370 if (version_major == 2 && smu->smu_table.boot_values.pp_table_id > 0) {
371 switch (version_minor) {
372 case 0:
373 ret = smu_v11_0_set_pptable_v2_0(smu, &table, &size);
374 break;
375 case 1:
376 ret = smu_v11_0_set_pptable_v2_1(smu, &table, &size,
377 smu->smu_table.boot_values.pp_table_id);
378 break;
379 default:
380 ret = -EINVAL;
381 break;
382 }
383 if (ret)
384 return ret;
385
386 } else {
387 index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1,
388 powerplayinfo);
389
390 ret = smu_get_atom_data_table(smu, index, (uint16_t *)&size, &frev, &crev,
^^^^^^^^^^^^^^^^^
This only initializes the highest 16 bits.
391 (uint8_t **)&table);
392 if (ret)
393 return ret;
394 }
395
396 if (!smu->smu_table.power_play_table)
397 smu->smu_table.power_play_table = table;
398 if (!smu->smu_table.power_play_table_size)
399 smu->smu_table.power_play_table_size = size;
400
401 return 0;
regards,
dan carpenter
More information about the amd-gfx
mailing list