Skip to contentSkip to conversation

Trivial powerplay fixup for drm-next-4.9

PATCH In review Edward O'Callaghan 2 participants 3 messages Sep 4, 2016 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 1472956579-26643-1-git-send-email-funfunctor-dczkZgxz+BNUPWh3PAxdjQ@public.gmane.org

#2 lore raw

PATCH 1/1 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.

---
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +3 -6
index 2de34a5..5ff1124 100644
@@ -765,15 +765,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);
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1472956579-26643-2-git-send-email-funfunctor-dczkZgxz+BNUPWh3PAxdjQ@public.gmane.org

Reviewed-by
#4 lore raw

Re: [PATCH] amd/powerplay: use kmemdup instead of kmalloc + memcpy

Am 04.09.2016 um 04:36 schrieb Edward O'Callaghan:

Quoted 4 lines

Save a few clocks by replacing calls to kmalloc followed by memcpy with a single call to kmemdup.

Quoted 17 lines
---
  drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 9 +++------
  1 file changed, 3 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +3 -2
index 2de34a5..5ff1124 100644
@@ -765,15 +765,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);

drivers/gpu/drm/amd/powerplay/amd_powerplay.c static int pp_dpm_set_pp_table(void *handle, const char *buf, size_t size) · line 776

Quoted 10 lines
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +0 -4
 
  		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);

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx