Commit 9ddcbf1f authored by Alex Dewar's avatar Alex Dewar Committed by Alex Deucher

drm/amd/pm: use kmemdup() rather than kmalloc+memcpy

Issue identified with Coccinelle.
Signed-off-by: default avatarAlex Dewar <alex.dewar90@gmail.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 4d2997ab
......@@ -890,14 +890,12 @@ static int init_powerplay_table_information(
power_saving_clock_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)
return -ENOMEM;
memcpy(pptable_information->smc_pptable,
&(powerplay_table->smcPPTable),
sizeof(PPTable_t));
result = append_vbios_pptable(hwmgr, (pptable_information->smc_pptable));
if (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