Commit e5285ac8 authored by Tian Tao's avatar Tian Tao Committed by Alex Deucher

drm/amd/pm: Use kmemdup instead of kmalloc and memcpy

Fixes coccicheck warning:
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_processpptables.c:255:
36-43: WARNING opportunity for kmemdup
Signed-off-by: default avatarTian Tao <tiantao6@hisilicon.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 03cc904c
...@@ -252,12 +252,11 @@ static int init_powerplay_table_information( ...@@ -252,12 +252,11 @@ static int init_powerplay_table_information(
phm_copy_clock_limits_array(hwmgr, &pptable_information->power_saving_clock_max, powerplay_table->PowerSavingClockMax, ATOM_VEGA12_PPCLOCK_COUNT); phm_copy_clock_limits_array(hwmgr, &pptable_information->power_saving_clock_max, powerplay_table->PowerSavingClockMax, ATOM_VEGA12_PPCLOCK_COUNT);
phm_copy_clock_limits_array(hwmgr, &pptable_information->power_saving_clock_min, powerplay_table->PowerSavingClockMin, ATOM_VEGA12_PPCLOCK_COUNT); phm_copy_clock_limits_array(hwmgr, &pptable_information->power_saving_clock_min, powerplay_table->PowerSavingClockMin, ATOM_VEGA12_PPCLOCK_COUNT);
pptable_information->smc_pptable = kmalloc(sizeof(PPTable_t), GFP_KERNEL); pptable_information->smc_pptable = kmemdup(&(powerplay_table->smcPPTable),
sizeof(PPTable_t), GFP_KERNEL);
if (pptable_information->smc_pptable == NULL) if (pptable_information->smc_pptable == NULL)
return -ENOMEM; return -ENOMEM;
memcpy(pptable_information->smc_pptable, &(powerplay_table->smcPPTable), sizeof(PPTable_t));
result = append_vbios_pptable(hwmgr, (pptable_information->smc_pptable)); result = append_vbios_pptable(hwmgr, (pptable_information->smc_pptable));
return result; return result;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment