drm/amd/powerplay/hwmgr: use kmemdup
Subsystems (2)
PATCH 1/1 drm/amd/powerplay/hwmgr: use kmemdup
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.
--- drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c +3 -3
@@ -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;
Signature · 1 line
1.9.1
PATCH 1/1 drm/amd/powerplay/hwmgr: use kmemdup
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.
--- drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c +3 -3
@@ -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;
Signature · 1 line
1.9.1
PATCH 1/1 drm/amd/powerplay/hwmgr: use kmemdup
In reply to Muhammad Falak R WaniUse 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.
--- drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c +3 -3
@@ -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;
Signature · 1 line
1.9.1
Quoted 5 lines · Muhammad Falak R Wani
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 <[email protected]>
Applied the hwmgr patches.
Thanks!
Alex
Quoted 26 lines
--- drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c +3
-4@@ -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
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel