提交 9ddcbf1f 编写于 作者: A Alex Dewar 提交者: Alex Deucher

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

Issue identified with Coccinelle.
Signed-off-by: NAlex Dewar <alex.dewar90@gmail.com>
Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册