drm/amd/powerplay: fix memdup.cocci warnings
Subsystems (2)
PATCH 1/1 drm/amd/powerplay: fix memdup.cocci warnings
From: kbuild test robot <[email protected]>
Simplify the code a bit by using kmemdup instead of kzalloc and memcpy.
Generated by: scripts/coccinelle/api/memdup.cocci
---
tree: git://people.freedesktop.org/~agd5f/linux.git drm-next-5.2-wip head: 25752e1fc83e9f983b11d680fc7bfc129b4eaae6 commit: 76760fe3c00d04f25cc1a6115294310d4effeb77 [161/226] drm/amd/powerplay: add function to store overdrive information for smu11
:::::: branch date: 6 hours ago
:::::: commit date: 6 hours ago
vega20_ppt.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/amdgpu/../powerplay/vega20_ppt.c +9 -15
@@ -173,14 +173,12 @@ static int vega20_setup_od8_information(if (table_context->od_feature_capabilities)return -EINVAL ; - table_context->od_feature_capabilities =kzalloc (od_feature_array_size,GFP_KERNEL ); + table_context->od_feature_capabilities =kmemdup (&powerplay_table->OverDrive8Table.ODFeatureCapabilities, + od_feature_array_size, +GFP_KERNEL );if (!table_context->od_feature_capabilities)return -ENOMEM ; -memcpy (table_context->od_feature_capabilities, - &powerplay_table->OverDrive8Table.ODFeatureCapabilities, - od_feature_array_size); -/* Setup correct ODSettingCount, and store ODSettingArray from * powerplay table to od_settings_max and od_setting_min */ od_setting_count =
@@ -194,7 +192,9 @@ static int vega20_setup_od8_information(if (table_context->od_settings_max)return -EINVAL ; - table_context->od_settings_max =kzalloc (od_setting_array_size,GFP_KERNEL ); + table_context->od_settings_max =kmemdup (&powerplay_table->OverDrive8Table.ODSettingsMax, + od_setting_array_size, +GFP_KERNEL );if (!table_context->od_settings_max) {kfree (table_context->od_feature_capabilities);
@@ -202,14 +202,12 @@ static int vega20_setup_od8_information(return -ENOMEM ; } -memcpy (table_context->od_settings_max, - &powerplay_table->OverDrive8Table.ODSettingsMax, - od_setting_array_size); -if (table_context->od_settings_min)return -EINVAL ; - table_context->od_settings_min =kzalloc (od_setting_array_size,GFP_KERNEL ); + table_context->od_settings_min =kmemdup (&powerplay_table->OverDrive8Table.ODSettingsMin, + od_setting_array_size, +GFP_KERNEL );if (!table_context->od_settings_min) {kfree (table_context->od_feature_capabilities);
@@ -218,10 +216,6 @@ static int vega20_setup_od8_information( table_context->od_settings_max =NULL ;return -ENOMEM ; } - -memcpy (table_context->od_settings_min, - &powerplay_table->OverDrive8Table.ODSettingsMin, - od_setting_array_size); }return 0 ;
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
-----Original Message-----
From: Julia Lawall <[email protected]>
Sent: Saturday, March 02, 2019 2:51 PM
To: Gao, Likun <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Wang, Kevin(Yang) <[email protected]>; Quan, Evan <[email protected]>; Koenig, Christian <[email protected]>; David Airlie <[email protected]>; Daniel Vetter <[email protected]>; Huang, Ray <[email protected]>; [email protected]; kbuild test robot <[email protected]>; [email protected]; [email protected]
Subject: [PATCH] drm/amd/powerplay: fix memdup.cocci warnings
From: kbuild test robot <[email protected]>
Simplify the code a bit by using kmemdup instead of kzalloc and memcpy.
Generated by: scripts/coccinelle/api/memdup.cocci
---
tree: git://people.freedesktop.org/~agd5f/linux.git drm-next-5.2-wip head: 25752e1fc83e9f983b11d680fc7bfc129b4eaae6 commit: 76760fe3c00d04f25cc1a6115294310d4effeb77 [161/226] drm/amd/powerplay: add function to store overdrive information for smu11
:::::: branch date: 6 hours ago
:::::: commit date: 6 hours ago
vega20_ppt.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/amdgpu/../powerplay/vega20_ppt.c +9 -15
@@ -173,14 +173,12 @@ static int vega20_setup_od8_information(if (table_context->od_feature_capabilities)return -EINVAL ; - table_context->od_feature_capabilities =kzalloc (od_feature_array_size,GFP_KERNEL ); + table_context->od_feature_capabilities =kmemdup (&powerplay_table->OverDrive8Table.ODFeatureCapabilities, + od_feature_array_size, +GFP_KERNEL );if (!table_context->od_feature_capabilities)return -ENOMEM ; -memcpy (table_context->od_feature_capabilities, - &powerplay_table->OverDrive8Table.ODFeatureCapabilities, - od_feature_array_size); -/* Setup correct ODSettingCount, and store ODSettingArray from * powerplay table to od_settings_max and od_setting_min */ od_setting_count =
@@ -194,7 +192,9 @@ static int vega20_setup_od8_information(if (table_context->od_settings_max)return -EINVAL ; - table_context->od_settings_max =kzalloc (od_setting_array_size,GFP_KERNEL ); + table_context->od_settings_max =kmemdup (&powerplay_table->OverDrive8Table.ODSettingsMax, + od_setting_array_size, +GFP_KERNEL );if (!table_context->od_settings_max) {kfree (table_context->od_feature_capabilities);
@@ -202,14 +202,12 @@ static int vega20_setup_od8_information(return -ENOMEM ; } -memcpy (table_context->od_settings_max, - &powerplay_table->OverDrive8Table.ODSettingsMax, - od_setting_array_size); -if (table_context->od_settings_min)return -EINVAL ; - table_context->od_settings_min =kzalloc (od_setting_array_size,GFP_KERNEL ); + table_context->od_settings_min =kmemdup (&powerplay_table->OverDrive8Table.ODSettingsMin, + od_setting_array_size, +GFP_KERNEL );if (!table_context->od_settings_min) {kfree (table_context->od_feature_capabilities);
@@ -218,10 +216,6 @@ static int vega20_setup_od8_information( table_context->od_settings_max =NULL ;return -ENOMEM ; } - -memcpy (table_context->od_settings_min, - &powerplay_table->OverDrive8Table.ODSettingsMin, - od_setting_array_size); }return 0 ;
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 16 lines
-----Original Message-----
From: Julia Lawall [mailto:[email protected]]
Sent: Saturday, March 02, 2019 2:51 PM
To: Gao, Likun <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Wang, Kevin(Yang) <[email protected]>; Quan, Evan <[email protected]>; Koenig, Christian <[email protected]>; David Airlie <[email protected]>; Daniel Vetter <[email protected]>; Huang, Ray <[email protected]>; amd- [email protected]; kbuild test robot <[email protected]>; dri- [email protected]; [email protected]
Subject: [PATCH] drm/amd/powerplay: fixmemdup.cocciwarningsFrom: kbuild test robot <[email protected]>
Simplify the code a bit by using kmemdup instead of kzalloc and memcpy.
Quoted 7 lines
Generated by:
scripts/coccinelle/api/memdup.cocciFixes 76760fe3c00d ("drm/amd/powerplay: add function to store overdriveinformation for smu11")
CC Likun Gao <[email protected]>Signed-off-by kbuild test robot <[email protected]>Signed-off-by Julia Lawall <[email protected]>
Quoted 75 lines
---
tree: git://people.freedesktop.org/~agd5f/linux.git drm-next-5.2-wip head: 25752e1fc83e9f983b11d680fc7bfc129b4eaae6 commit: 76760fe3c00d04f25cc1a6115294310d4effeb77 [161/226] drm/amd/powerplay: add function to store overdrive information for smu11:::::: branch date: 6 hours ago
:::::: commit date: 6 hours agovega20_ppt.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-)drivers/gpu/drm/amd/amdgpu/../powerplay/vega20_ppt.c +3
-3@@ -173,14 +173,12 @@ static int vega20_setup_od8_information(if (table_context->od_feature_capabilities)return -EINVAL ; - table_context->od_feature_capabilities =kzalloc (od_feature_array_size,GFP_KERNEL ); + table_context->od_feature_capabilities =kmemdup (&powerplay_table->OverDrive8Table.ODFeatureCapabilities, + od_feature_array_size, +GFP_KERNEL );if (!table_context->od_feature_capabilities)return -ENOMEM ; - memcpy(table_context->od_feature_capabilities, - &powerplay_table-Quoted 1 line
OverDrive8Table.ODFeatureCapabilities,
drivers/gpu/drm/amd/amdgpu/../powerplay/vega20_ppt.c +0
-2- od_feature_array_size); -/* Setup correct ODSettingCount, and store ODSettingArray from
* powerplay table tood_settings_maxandod_setting_min
*/drivers/gpu/drm/amd/amdgpu/../powerplay/vega20_ppt.c +3
-1od_setting_count =@@ -194,7 +192,9 @@ static int vega20_setup_od8_information(if (table_context->od_settings_max)return -EINVAL ; - table_context->od_settings_max =kzalloc (od_setting_array_size,GFP_KERNEL ); + table_context->od_settings_max =kmemdup (&powerplay_table->OverDrive8Table.ODSettingsMax, + od_setting_array_size, +GFP_KERNEL );drivers/gpu/drm/amd/amdgpu/../powerplay/vega20_ppt.c +3
-5if (!table_context->od_settings_max) {kfree (table_context->od_feature_capabilities);@@ -202,14 +202,12 @@ static int vega20_setup_od8_information(return -ENOMEM ; } -memcpy (table_context->od_settings_max, - &powerplay_table->OverDrive8Table.ODSettingsMax, - od_setting_array_size); -if (table_context->od_settings_min)return -EINVAL ; - table_context->od_settings_min =kzalloc (od_setting_array_size,GFP_KERNEL ); + table_context->od_settings_min =kmemdup (&powerplay_table->OverDrive8Table.ODSettingsMin, + od_setting_array_size, +GFP_KERNEL );drivers/gpu/drm/amd/amdgpu/../powerplay/vega20_ppt.c +0
-0if (!table_context->od_settings_min) {kfree (table_context->od_feature_capabilities);
drivers/gpu/drm/amd/amdgpu/../powerplay/vega20_ppt.c static int vega20_setup_od8_information( · line 221
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/../powerplay/vega20_ppt.c +0
-4@@ -218,10 +216,6 @@ static int vega20_setup_od8_information( table_context->od_settings_max =NULL ;return -ENOMEM ; } - -memcpy (table_context->od_settings_min, - &powerplay_table->OverDrive8Table.ODSettingsMin, - od_setting_array_size); }return 0 ;
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx