diff options
author | Edward O'Callaghan <funfunctor@folklore1984.net> | 2016-09-03 22:36:19 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2016-09-14 15:10:36 -0400 |
commit | efdf7a93195a712baff7aa077ae5e4542a9af2f9 (patch) | |
tree | 203d349bc125f2e837ae9c9c68d1bd1a0fa6621f | |
parent | 41698abb4d418b83b4d9fdae1172e00b91e46b54 (diff) |
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>
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 9 |
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) | |||
764 | PP_CHECK_HW(hwmgr); | 764 | PP_CHECK_HW(hwmgr); |
765 | 765 | ||
766 | if (!hwmgr->hardcode_pp_table) { | 766 | if (!hwmgr->hardcode_pp_table) { |
767 | hwmgr->hardcode_pp_table = | 767 | hwmgr->hardcode_pp_table = kmemdup(hwmgr->soft_pp_table, |
768 | kzalloc(hwmgr->soft_pp_table_size, GFP_KERNEL); | 768 | hwmgr->soft_pp_table_size, |
769 | GFP_KERNEL); | ||
769 | 770 | ||
770 | if (!hwmgr->hardcode_pp_table) | 771 | if (!hwmgr->hardcode_pp_table) |
771 | return -ENOMEM; | 772 | return -ENOMEM; |
772 | |||
773 | /* to avoid powerplay crash when hardcode pptable is empty */ | ||
774 | memcpy(hwmgr->hardcode_pp_table, hwmgr->soft_pp_table, | ||
775 | hwmgr->soft_pp_table_size); | ||
776 | } | 773 | } |
777 | 774 | ||
778 | memcpy(hwmgr->hardcode_pp_table, buf, size); | 775 | memcpy(hwmgr->hardcode_pp_table, buf, size); |