summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
diff options
context:
space:
mode:
authorEdward O'Callaghan <funfunctor@folklore1984.net>2016-09-04 12:36:19 +1000
committerAlex Deucher <alexander.deucher@amd.com>2016-09-14 15:10:36 -0400
commitefdf7a93195a712baff7aa077ae5e4542a9af2f9 (patch)
tree203d349bc125f2e837ae9c9c68d1bd1a0fa6621f /drivers/gpu/drm/amd/powerplay/amd_powerplay.c
parent41698abb4d418b83b4d9fdae1172e00b91e46b54 (diff)
downloadlinux-stable-efdf7a93195a712baff7aa077ae5e4542a9af2f9.tar.gz
linux-stable-efdf7a93195a712baff7aa077ae5e4542a9af2f9.tar.bz2
linux-stable-efdf7a93195a712baff7aa077ae5e4542a9af2f9.zip
amd/powerplay: use kmemdup instead of kmalloc + memcpy
Save a few clocks by replacing calls to kmalloc followed by memcpy with a single call to kmemdup. Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Edward O'Callaghan <funfunctor@folklore1984.net> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/powerplay/amd_powerplay.c')
-rw-r--r--drivers/gpu/drm/amd/powerplay/amd_powerplay.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
index 3e7235ffb009..b1d19409bf86 100644
--- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
+++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
@@ -764,15 +764,12 @@ static int pp_dpm_set_pp_table(void *handle, const char *buf, size_t size)
PP_CHECK_HW(hwmgr);
if (!hwmgr->hardcode_pp_table) {
- hwmgr->hardcode_pp_table =
- kzalloc(hwmgr->soft_pp_table_size, GFP_KERNEL);
+ hwmgr->hardcode_pp_table = kmemdup(hwmgr->soft_pp_table,
+ hwmgr->soft_pp_table_size,
+ GFP_KERNEL);
if (!hwmgr->hardcode_pp_table)
return -ENOMEM;
-
- /* to avoid powerplay crash when hardcode pptable is empty */
- memcpy(hwmgr->hardcode_pp_table, hwmgr->soft_pp_table,
- hwmgr->soft_pp_table_size);
}
memcpy(hwmgr->hardcode_pp_table, buf, size);