mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/amd/powerplay/hwmgr: use kmemdup
@ 2016-05-19 11:15 Muhammad Falak R Wani
  2016-05-19 11:15 ` Muhammad Falak R Wani
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Muhammad Falak R Wani @ 2016-05-19 11:15 UTC (permalink / raw)
  To: David Airlie
  Cc: Alex Deucher, Christian König, Rex Zhu, Eric Huang,
	Nils Wallménius, Jammy Zhou, dri-devel, linux-kernel

Use kmemdup when some other buffer is immediately copied into allocated
region. It replaces call to allocation followed by memcpy, by a single
call to kmemdup.

Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
---
 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c
index c94f9fa..1471ac3 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c
@@ -5109,11 +5109,11 @@ static int fiji_get_pp_table(struct pp_hwmgr *hwmgr, char **table)
 	struct fiji_hwmgr *data = (struct fiji_hwmgr *)(hwmgr->backend);
 
 	if (!data->soft_pp_table) {
-		data->soft_pp_table = kzalloc(hwmgr->soft_pp_table_size, GFP_KERNEL);
+		data->soft_pp_table = kmemdup(hwmgr->soft_pp_table,
+					      hwmgr->soft_pp_table_size,
+					      GFP_KERNEL);
 		if (!data->soft_pp_table)
 			return -ENOMEM;
-		memcpy(data->soft_pp_table, hwmgr->soft_pp_table,
-				hwmgr->soft_pp_table_size);
 	}
 
 	*table = (char *)&data->soft_pp_table;
-- 
1.9.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] drm/amd/powerplay/hwmgr: use kmemdup
  2016-05-19 11:15 [PATCH] drm/amd/powerplay/hwmgr: use kmemdup Muhammad Falak R Wani
@ 2016-05-19 11:15 ` Muhammad Falak R Wani
  2016-05-19 11:15 ` Muhammad Falak R Wani
  2016-05-19 15:03 ` Alex Deucher
  2 siblings, 0 replies; 4+ messages in thread
From: Muhammad Falak R Wani @ 2016-05-19 11:15 UTC (permalink / raw)
  To: David Airlie
  Cc: Alex Deucher, Christian König, Rex Zhu, Eric Huang,
	Nils Wallménius, dri-devel, linux-kernel

Use kmemdup when some other buffer is immediately copied into allocated
region. It replaces call to allocation followed by memcpy, by a single
call to kmemdup.

Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
---
 drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c
index 93768fa..b7dad50 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c
@@ -4760,11 +4760,11 @@ static int polaris10_get_pp_table(struct pp_hwmgr *hwmgr, char **table)
 	struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend);
 
 	if (!data->soft_pp_table) {
-		data->soft_pp_table = kzalloc(hwmgr->soft_pp_table_size, GFP_KERNEL);
+		data->soft_pp_table = kmemdup(hwmgr->soft_pp_table,
+					      hwmgr->soft_pp_table_size,
+					      GFP_KERNEL);
 		if (!data->soft_pp_table)
 			return -ENOMEM;
-		memcpy(data->soft_pp_table, hwmgr->soft_pp_table,
-				hwmgr->soft_pp_table_size);
 	}
 
 	*table = (char *)&data->soft_pp_table;
-- 
1.9.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] drm/amd/powerplay/hwmgr: use kmemdup
  2016-05-19 11:15 [PATCH] drm/amd/powerplay/hwmgr: use kmemdup Muhammad Falak R Wani
  2016-05-19 11:15 ` Muhammad Falak R Wani
@ 2016-05-19 11:15 ` Muhammad Falak R Wani
  2016-05-19 15:03 ` Alex Deucher
  2 siblings, 0 replies; 4+ messages in thread
From: Muhammad Falak R Wani @ 2016-05-19 11:15 UTC (permalink / raw)
  To: David Airlie
  Cc: Alex Deucher, Christian König, Rex Zhu, Eric Huang,
	Jammy Zhou, Nils Wallménius, Moritz Kühner, yanyang1,
	dri-devel, linux-kernel

Use kmemdup when some other buffer is immediately copied into allocated
region. It replaces call to allocation followed by memcpy, by a single
call to kmemdup.

Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
---
 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c
index 1faad92..df399fe 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c
@@ -6056,11 +6056,11 @@ static int tonga_get_pp_table(struct pp_hwmgr *hwmgr, char **table)
 	struct tonga_hwmgr *data = (struct tonga_hwmgr *)(hwmgr->backend);
 
 	if (!data->soft_pp_table) {
-		data->soft_pp_table = kzalloc(hwmgr->soft_pp_table_size, GFP_KERNEL);
+		data->soft_pp_table = kmemdup(hwmgr->soft_pp_table,
+					      hwmgr->soft_pp_table_size,
+					      GFP_KERNEL);
 		if (!data->soft_pp_table)
 			return -ENOMEM;
-		memcpy(data->soft_pp_table, hwmgr->soft_pp_table,
-				hwmgr->soft_pp_table_size);
 	}
 
 	*table = (char *)&data->soft_pp_table;
-- 
1.9.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/amd/powerplay/hwmgr: use kmemdup
  2016-05-19 11:15 [PATCH] drm/amd/powerplay/hwmgr: use kmemdup Muhammad Falak R Wani
  2016-05-19 11:15 ` Muhammad Falak R Wani
  2016-05-19 11:15 ` Muhammad Falak R Wani
@ 2016-05-19 15:03 ` Alex Deucher
  2 siblings, 0 replies; 4+ messages in thread
From: Alex Deucher @ 2016-05-19 15:03 UTC (permalink / raw)
  To: Muhammad Falak R Wani
  Cc: David Airlie, Nils Wallménius, Jammy Zhou, LKML,
	Maling list - DRI developers, Eric Huang, Alex Deucher, Rex Zhu,
	Christian König

On Thu, May 19, 2016 at 7:15 AM, Muhammad Falak R Wani
<falakreyaz@gmail.com> wrote:
> Use kmemdup when some other buffer is immediately copied into allocated
> region. It replaces call to allocation followed by memcpy, by a single
> call to kmemdup.
>
> Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>

Applied the hwmgr patches.

Thanks!

Alex

> ---
>  drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c
> index c94f9fa..1471ac3 100644
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c
> @@ -5109,11 +5109,11 @@ static int fiji_get_pp_table(struct pp_hwmgr *hwmgr, char **table)
>         struct fiji_hwmgr *data = (struct fiji_hwmgr *)(hwmgr->backend);
>
>         if (!data->soft_pp_table) {
> -               data->soft_pp_table = kzalloc(hwmgr->soft_pp_table_size, GFP_KERNEL);
> +               data->soft_pp_table = kmemdup(hwmgr->soft_pp_table,
> +                                             hwmgr->soft_pp_table_size,
> +                                             GFP_KERNEL);
>                 if (!data->soft_pp_table)
>                         return -ENOMEM;
> -               memcpy(data->soft_pp_table, hwmgr->soft_pp_table,
> -                               hwmgr->soft_pp_table_size);
>         }
>
>         *table = (char *)&data->soft_pp_table;
> --
> 1.9.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-05-19 15:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-19 11:15 [PATCH] drm/amd/powerplay/hwmgr: use kmemdup Muhammad Falak R Wani
2016-05-19 11:15 ` Muhammad Falak R Wani
2016-05-19 11:15 ` Muhammad Falak R Wani
2016-05-19 15:03 ` Alex Deucher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®