Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1403650 > unrolled thread

[PATCH] drm/amd/powerplay/hwmgr: use kmemdup

Started byMuhammad Falak R Wani <falakreyaz@gmail.com>
First post2016-05-19 13:20 +0200
Last post2016-05-19 17:10 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] drm/amd/powerplay/hwmgr: use kmemdup Muhammad Falak R Wani <falakreyaz@gmail.com> - 2016-05-19 13:20 +0200
    [PATCH] drm/amd/powerplay/hwmgr: use kmemdup Muhammad Falak R Wani <falakreyaz@gmail.com> - 2016-05-19 13:20 +0200
    Re: [PATCH] drm/amd/powerplay/hwmgr: use kmemdup Alex Deucher <alexdeucher@gmail.com> - 2016-05-19 17:10 +0200

#1403650 — [PATCH] drm/amd/powerplay/hwmgr: use kmemdup

FromMuhammad Falak R Wani <falakreyaz@gmail.com>
Date2016-05-19 13:20 +0200
Subject[PATCH] drm/amd/powerplay/hwmgr: use kmemdup
Message-ID<rAu9H-7pe-11@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1403652

FromMuhammad Falak R Wani <falakreyaz@gmail.com>
Date2016-05-19 13:20 +0200
Message-ID<rAu9I-7pe-15@gated-at.bofh.it>
In reply to#1403650
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

[toc] | [prev] | [next] | [standalone]


#1403803

FromAlex Deucher <alexdeucher@gmail.com>
Date2016-05-19 17:10 +0200
Message-ID<rAxKi-1oW-9@gated-at.bofh.it>
In reply to#1403650
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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web