diff options
author | Alex Dewar <alex.dewar90@gmail.com> | 2020-08-24 22:15:25 +0100 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2020-08-26 16:40:19 -0400 |
commit | 9ddcbf1f4c2d8dadd577c7ee5ae3a5168ebfae96 (patch) | |
tree | 07ce9fea86d5714325d64fa75991e708ba76914a /drivers | |
parent | 4d2997ab2182fc58e93d33819ea2e2a0a87e6bb9 (diff) |
drm/amd/pm: use kmemdup() rather than kmalloc+memcpy
Issue identified with Coccinelle.
Signed-off-by: Alex Dewar <alex.dewar90@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_processpptables.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_processpptables.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_processpptables.c index f56a3cbdfa3b..1f9082539457 100644 --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_processpptables.c +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_processpptables.c @@ -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) |