summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/pm/powerplay
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-02-21 11:02:58 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2026-02-21 11:02:58 -0800
commit8934827db5403eae57d4537114a9ff88b0a8460f (patch)
tree5167aa7e16b786b9135e19d508b234054fa6e8ce /drivers/gpu/drm/amd/pm/powerplay
parentc7decec2f2d2ab0366567f9e30c0e1418cece43f (diff)
parent7a70c15bd1449f1eb30991772edce37b41e496fb (diff)
Merge tag 'kmalloc_obj-treewide-v7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linuxHEADmaster
Pull kmalloc_obj conversion from Kees Cook: "This does the tree-wide conversion to kmalloc_obj() and friends using coccinelle, with a subsequent small manual cleanup of whitespace alignment that coccinelle does not handle. This uncovered a clang bug in __builtin_counted_by_ref(), so the conversion is preceded by disabling that for current versions of clang. The imminent clang 22.1 release has the fix. I've done allmodconfig build tests for x86_64, arm64, i386, and arm. I did defconfig builds for alpha, m68k, mips, parisc, powerpc, riscv, s390, sparc, sh, arc, csky, xtensa, hexagon, and openrisc" * tag 'kmalloc_obj-treewide-v7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: kmalloc_obj: Clean up after treewide replacements treewide: Replace kmalloc with kmalloc_obj for non-scalar types compiler_types: Disable __builtin_counted_by_ref for Clang
Diffstat (limited to 'drivers/gpu/drm/amd/pm/powerplay')
-rw-r--r--drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c2
-rw-r--r--drivers/gpu/drm/amd/pm/powerplay/hwmgr/process_pptables_v1_0.c39
-rw-r--r--drivers/gpu/drm/amd/pm/powerplay/hwmgr/processpptables.c34
-rw-r--r--drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c7
-rw-r--r--drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c4
-rw-r--r--drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c5
-rw-r--r--drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu_helper.c8
-rw-r--r--drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c5
-rw-r--r--drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_processpptables.c35
-rw-r--r--drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_hwmgr.c2
-rw-r--r--drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_processpptables.c2
-rw-r--r--drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c2
-rw-r--r--drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_processpptables.c2
-rw-r--r--drivers/gpu/drm/amd/pm/powerplay/smumgr/ci_smumgr.c4
-rw-r--r--drivers/gpu/drm/amd/pm/powerplay/smumgr/fiji_smumgr.c2
-rw-r--r--drivers/gpu/drm/amd/pm/powerplay/smumgr/iceland_smumgr.c4
-rw-r--r--drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c2
-rw-r--r--drivers/gpu/drm/amd/pm/powerplay/smumgr/smu10_smumgr.c2
-rw-r--r--drivers/gpu/drm/amd/pm/powerplay/smumgr/smu7_smumgr.c2
-rw-r--r--drivers/gpu/drm/amd/pm/powerplay/smumgr/smu8_smumgr.c2
-rw-r--r--drivers/gpu/drm/amd/pm/powerplay/smumgr/tonga_smumgr.c4
-rw-r--r--drivers/gpu/drm/amd/pm/powerplay/smumgr/vega10_smumgr.c2
-rw-r--r--drivers/gpu/drm/amd/pm/powerplay/smumgr/vega12_smumgr.c2
-rw-r--r--drivers/gpu/drm/amd/pm/powerplay/smumgr/vega20_smumgr.c2
-rw-r--r--drivers/gpu/drm/amd/pm/powerplay/smumgr/vegam_smumgr.c2
25 files changed, 87 insertions, 90 deletions
diff --git a/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c
index 0bbb89788335..cd3036e33c5a 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c
@@ -41,7 +41,7 @@ static int amd_powerplay_create(struct amdgpu_device *adev)
if (adev == NULL)
return -EINVAL;
- hwmgr = kzalloc(sizeof(struct pp_hwmgr), GFP_KERNEL);
+ hwmgr = kzalloc_obj(struct pp_hwmgr, GFP_KERNEL);
if (hwmgr == NULL)
return -ENOMEM;
diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/process_pptables_v1_0.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/process_pptables_v1_0.c
index 6cfef1b295ab..a1292d5b0a1c 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/process_pptables_v1_0.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/process_pptables_v1_0.c
@@ -165,7 +165,7 @@ static int get_vddc_lookup_table(
PP_ASSERT_WITH_CODE((0 != vddc_lookup_pp_tables->ucNumEntries),
"Invalid CAC Leakage PowerPlay Table!", return 1);
- table = kzalloc(struct_size(table, entries, max_levels), GFP_KERNEL);
+ table = kzalloc_flex(*table, entries, max_levels, GFP_KERNEL);
if (!table)
return -ENOMEM;
@@ -200,7 +200,7 @@ static int get_platform_power_management_table(
struct pp_hwmgr *hwmgr,
ATOM_Tonga_PPM_Table *atom_ppm_table)
{
- struct phm_ppm_table *ptr = kzalloc(sizeof(*ptr), GFP_KERNEL);
+ struct phm_ppm_table *ptr = kzalloc_obj(*ptr, GFP_KERNEL);
struct phm_ppt_v1_information *pp_table_information =
(struct phm_ppt_v1_information *)(hwmgr->pptable);
@@ -321,8 +321,8 @@ static int get_valid_clk(
PP_ASSERT_WITH_CODE((0 != clk_volt_pp_table->count),
"Invalid PowerPlay Table!", return -1);
- table = kzalloc(struct_size(table, values, clk_volt_pp_table->count),
- GFP_KERNEL);
+ table = kzalloc_flex(*table, values, clk_volt_pp_table->count,
+ GFP_KERNEL);
if (!table)
return -ENOMEM;
@@ -371,8 +371,8 @@ static int get_mclk_voltage_dependency_table(
PP_ASSERT_WITH_CODE((0 != mclk_dep_table->ucNumEntries),
"Invalid PowerPlay Table!", return -1);
- mclk_table = kzalloc(struct_size(mclk_table, entries, mclk_dep_table->ucNumEntries),
- GFP_KERNEL);
+ mclk_table = kzalloc_flex(*mclk_table, entries,
+ mclk_dep_table->ucNumEntries, GFP_KERNEL);
if (!mclk_table)
return -ENOMEM;
@@ -415,8 +415,8 @@ static int get_sclk_voltage_dependency_table(
PP_ASSERT_WITH_CODE((0 != tonga_table->ucNumEntries),
"Invalid PowerPlay Table!", return -1);
- sclk_table = kzalloc(struct_size(sclk_table, entries, tonga_table->ucNumEntries),
- GFP_KERNEL);
+ sclk_table = kzalloc_flex(*sclk_table, entries,
+ tonga_table->ucNumEntries, GFP_KERNEL);
if (!sclk_table)
return -ENOMEM;
@@ -444,8 +444,9 @@ static int get_sclk_voltage_dependency_table(
PP_ASSERT_WITH_CODE((0 != polaris_table->ucNumEntries),
"Invalid PowerPlay Table!", return -1);
- sclk_table = kzalloc(struct_size(sclk_table, entries, polaris_table->ucNumEntries),
- GFP_KERNEL);
+ sclk_table = kzalloc_flex(*sclk_table, entries,
+ polaris_table->ucNumEntries,
+ GFP_KERNEL);
if (!sclk_table)
return -ENOMEM;
@@ -491,9 +492,9 @@ static int get_pcie_table(
PP_ASSERT_WITH_CODE((atom_pcie_table->ucNumEntries != 0),
"Invalid PowerPlay Table!", return -1);
- pcie_table = kzalloc(struct_size(pcie_table, entries,
- atom_pcie_table->ucNumEntries),
- GFP_KERNEL);
+ pcie_table = kzalloc_flex(*pcie_table, entries,
+ atom_pcie_table->ucNumEntries,
+ GFP_KERNEL);
if (!pcie_table)
return -ENOMEM;
@@ -528,9 +529,9 @@ static int get_pcie_table(
PP_ASSERT_WITH_CODE((atom_pcie_table->ucNumEntries != 0),
"Invalid PowerPlay Table!", return -1);
- pcie_table = kzalloc(struct_size(pcie_table, entries,
- atom_pcie_table->ucNumEntries),
- GFP_KERNEL);
+ pcie_table = kzalloc_flex(*pcie_table, entries,
+ atom_pcie_table->ucNumEntries,
+ GFP_KERNEL);
if (!pcie_table)
return -ENOMEM;
@@ -724,8 +725,8 @@ static int get_mm_clock_voltage_table(
PP_ASSERT_WITH_CODE((0 != mm_dependency_table->ucNumEntries),
"Invalid PowerPlay Table!", return -1);
- mm_table = kzalloc(struct_size(mm_table, entries, mm_dependency_table->ucNumEntries),
- GFP_KERNEL);
+ mm_table = kzalloc_flex(*mm_table, entries,
+ mm_dependency_table->ucNumEntries, GFP_KERNEL);
if (!mm_table)
return -ENOMEM;
@@ -1141,7 +1142,7 @@ static int pp_tables_v1_0_initialize(struct pp_hwmgr *hwmgr)
int result = 0;
const ATOM_Tonga_POWERPLAYTABLE *powerplay_table;
- hwmgr->pptable = kzalloc(sizeof(struct phm_ppt_v1_information), GFP_KERNEL);
+ hwmgr->pptable = kzalloc_obj(struct phm_ppt_v1_information, GFP_KERNEL);
PP_ASSERT_WITH_CODE((NULL != hwmgr->pptable),
"Failed to allocate hwmgr->pptable!", return -ENOMEM);
diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/processpptables.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/processpptables.c
index f06b29e33ba4..b19409890899 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/processpptables.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/processpptables.c
@@ -382,8 +382,8 @@ static int get_clock_voltage_dependency_table(struct pp_hwmgr *hwmgr,
unsigned long i;
struct phm_clock_voltage_dependency_table *dep_table;
- dep_table = kzalloc(struct_size(dep_table, entries, table->ucNumEntries),
- GFP_KERNEL);
+ dep_table = kzalloc_flex(*dep_table, entries, table->ucNumEntries,
+ GFP_KERNEL);
if (NULL == dep_table)
return -ENOMEM;
@@ -409,7 +409,8 @@ static int get_valid_clk(struct pp_hwmgr *hwmgr,
unsigned long i;
struct phm_clock_array *clock_table;
- clock_table = kzalloc(struct_size(clock_table, values, table->count), GFP_KERNEL);
+ clock_table = kzalloc_flex(*clock_table, values, table->count,
+ GFP_KERNEL);
if (!clock_table)
return -ENOMEM;
@@ -1209,8 +1210,8 @@ static int get_uvd_clock_voltage_limit_table(struct pp_hwmgr *hwmgr,
unsigned long i;
struct phm_uvd_clock_voltage_dependency_table *uvd_table;
- uvd_table = kzalloc(struct_size(uvd_table, entries, table->numEntries),
- GFP_KERNEL);
+ uvd_table = kzalloc_flex(*uvd_table, entries, table->numEntries,
+ GFP_KERNEL);
if (!uvd_table)
return -ENOMEM;
@@ -1239,8 +1240,8 @@ static int get_vce_clock_voltage_limit_table(struct pp_hwmgr *hwmgr,
unsigned long i;
struct phm_vce_clock_voltage_dependency_table *vce_table;
- vce_table = kzalloc(struct_size(vce_table, entries, table->numEntries),
- GFP_KERNEL);
+ vce_table = kzalloc_flex(*vce_table, entries, table->numEntries,
+ GFP_KERNEL);
if (!vce_table)
return -ENOMEM;
@@ -1267,8 +1268,8 @@ static int get_samu_clock_voltage_limit_table(struct pp_hwmgr *hwmgr,
unsigned long i;
struct phm_samu_clock_voltage_dependency_table *samu_table;
- samu_table = kzalloc(struct_size(samu_table, entries, table->numEntries),
- GFP_KERNEL);
+ samu_table = kzalloc_flex(*samu_table, entries, table->numEntries,
+ GFP_KERNEL);
if (!samu_table)
return -ENOMEM;
@@ -1292,8 +1293,8 @@ static int get_acp_clock_voltage_limit_table(struct pp_hwmgr *hwmgr,
unsigned long i;
struct phm_acp_clock_voltage_dependency_table *acp_table;
- acp_table = kzalloc(struct_size(acp_table, entries, table->numEntries),
- GFP_KERNEL);
+ acp_table = kzalloc_flex(*acp_table, entries, table->numEntries,
+ GFP_KERNEL);
if (!acp_table)
return -ENOMEM;
@@ -1487,8 +1488,8 @@ static int get_cac_leakage_table(struct pp_hwmgr *hwmgr,
if (!hwmgr || !table || !ptable)
return -EINVAL;
- cac_leakage_table = kzalloc(struct_size(cac_leakage_table, entries, table->ucNumEntries),
- GFP_KERNEL);
+ cac_leakage_table = kzalloc_flex(*cac_leakage_table, entries,
+ table->ucNumEntries, GFP_KERNEL);
if (!cac_leakage_table)
return -ENOMEM;
@@ -1514,7 +1515,8 @@ static int get_cac_leakage_table(struct pp_hwmgr *hwmgr,
static int get_platform_power_management_table(struct pp_hwmgr *hwmgr,
ATOM_PPLIB_PPM_Table *atom_ppm_table)
{
- struct phm_ppm_table *ptr = kzalloc(sizeof(struct phm_ppm_table), GFP_KERNEL);
+ struct phm_ppm_table *ptr = kzalloc_obj(struct phm_ppm_table,
+ GFP_KERNEL);
if (NULL == ptr)
return -ENOMEM;
@@ -1625,8 +1627,8 @@ static int init_phase_shedding_table(struct pp_hwmgr *hwmgr,
unsigned long i;
- table = kzalloc(struct_size(table, entries, ptable->ucNumEntries),
- GFP_KERNEL);
+ table = kzalloc_flex(*table, entries,
+ ptable->ucNumEntries, GFP_KERNEL);
if (!table)
return -ENOMEM;
diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c
index 8de8d66df95f..49dc20b790ad 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c
@@ -133,8 +133,7 @@ static int smu10_init_dynamic_state_adjustment_rule_settings(
int count = 8;
struct phm_clock_voltage_dependency_table *table_clk_vlt;
- table_clk_vlt = kzalloc(struct_size(table_clk_vlt, entries, count),
- GFP_KERNEL);
+ table_clk_vlt = kzalloc_flex(*table_clk_vlt, entries, count, GFP_KERNEL);
if (NULL == table_clk_vlt) {
pr_err("Can not allocate memory!\n");
@@ -473,7 +472,7 @@ static int smu10_get_clock_voltage_dependency_table(struct pp_hwmgr *hwmgr,
uint32_t i;
struct smu10_voltage_dependency_table *ptable;
- ptable = kzalloc(struct_size(ptable, entries, num_entry), GFP_KERNEL);
+ ptable = kzalloc_flex(*ptable, entries, num_entry, GFP_KERNEL);
if (NULL == ptable)
return -ENOMEM;
@@ -551,7 +550,7 @@ static int smu10_hwmgr_backend_init(struct pp_hwmgr *hwmgr)
int result = 0;
struct smu10_hwmgr *data;
- data = kzalloc(sizeof(struct smu10_hwmgr), GFP_KERNEL);
+ data = kzalloc_obj(struct smu10_hwmgr, GFP_KERNEL);
if (data == NULL)
return -ENOMEM;
diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c
index 2be584aefd0a..a97136743723 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c
@@ -2961,7 +2961,7 @@ static int smu7_hwmgr_backend_init(struct pp_hwmgr *hwmgr)
struct smu7_hwmgr *data;
int result = 0;
- data = kzalloc(sizeof(struct smu7_hwmgr), GFP_KERNEL);
+ data = kzalloc_obj(struct smu7_hwmgr, GFP_KERNEL);
if (data == NULL)
return -ENOMEM;
@@ -4652,7 +4652,7 @@ static const struct amdgpu_irq_src_funcs smu7_irq_funcs = {
static int smu7_register_irq_handlers(struct pp_hwmgr *hwmgr)
{
struct amdgpu_irq_src *source =
- kzalloc(sizeof(struct amdgpu_irq_src), GFP_KERNEL);
+ kzalloc_obj(struct amdgpu_irq_src, GFP_KERNEL);
if (!source)
return -ENOMEM;
diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c
index 736e5a8af477..5d20c41b3803 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c
@@ -276,8 +276,7 @@ static int smu8_init_dynamic_state_adjustment_rule_settings(
{
struct phm_clock_voltage_dependency_table *table_clk_vlt;
- table_clk_vlt = kzalloc(struct_size(table_clk_vlt, entries, 8),
- GFP_KERNEL);
+ table_clk_vlt = kzalloc_flex(*table_clk_vlt, entries, 8, GFP_KERNEL);
if (NULL == table_clk_vlt) {
pr_err("Can not allocate memory!\n");
@@ -1122,7 +1121,7 @@ static int smu8_hwmgr_backend_init(struct pp_hwmgr *hwmgr)
int result = 0;
struct smu8_hwmgr *data;
- data = kzalloc(sizeof(struct smu8_hwmgr), GFP_KERNEL);
+ data = kzalloc_obj(struct smu8_hwmgr, GFP_KERNEL);
if (data == NULL)
return -ENOMEM;
diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu_helper.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu_helper.c
index c305ea4ec17d..68ae1bc36a7f 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu_helper.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu_helper.c
@@ -211,8 +211,7 @@ int phm_trim_voltage_table(struct pp_atomctrl_voltage_table *vol_table)
PP_ASSERT_WITH_CODE((NULL != vol_table),
"Voltage Table empty.", return -EINVAL);
- table = kzalloc(sizeof(struct pp_atomctrl_voltage_table),
- GFP_KERNEL);
+ table = kzalloc_obj(struct pp_atomctrl_voltage_table, GFP_KERNEL);
if (NULL == table)
return -EINVAL;
@@ -496,8 +495,7 @@ int phm_initializa_dynamic_state_adjustment_rule_settings(struct pp_hwmgr *hwmgr
struct phm_ppt_v1_information *pptable_info = (struct phm_ppt_v1_information *)(hwmgr->pptable);
/* initialize vddc_dep_on_dal_pwrl table */
- table_clk_vlt = kzalloc(struct_size(table_clk_vlt, entries, 4),
- GFP_KERNEL);
+ table_clk_vlt = kzalloc_flex(*table_clk_vlt, entries, 4, GFP_KERNEL);
if (NULL == table_clk_vlt) {
pr_err("Can not allocate space for vddc_dep_on_dal_pwrl! \n");
@@ -646,7 +644,7 @@ static const struct amdgpu_irq_src_funcs smu9_irq_funcs = {
int smu9_register_irq_handlers(struct pp_hwmgr *hwmgr)
{
struct amdgpu_irq_src *source =
- kzalloc(sizeof(struct amdgpu_irq_src), GFP_KERNEL);
+ kzalloc_obj(struct amdgpu_irq_src, GFP_KERNEL);
if (!source)
return -ENOMEM;
diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c
index 1b8a57d98759..255fa6c96120 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c
@@ -831,7 +831,7 @@ static int vega10_hwmgr_backend_init(struct pp_hwmgr *hwmgr)
struct pp_atomfwctrl_voltage_table vol_table;
struct amdgpu_device *adev = hwmgr->adev;
- data = kzalloc(sizeof(struct vega10_hwmgr), GFP_KERNEL);
+ data = kzalloc_obj(struct vega10_hwmgr, GFP_KERNEL);
if (data == NULL)
return -ENOMEM;
@@ -1029,8 +1029,7 @@ static int vega10_trim_voltage_table(struct pp_hwmgr *hwmgr,
PP_ASSERT_WITH_CODE(vol_table,
"Voltage Table empty.", return -EINVAL);
- table = kzalloc(sizeof(struct pp_atomfwctrl_voltage_table),
- GFP_KERNEL);
+ table = kzalloc_obj(struct pp_atomfwctrl_voltage_table, GFP_KERNEL);
if (!table)
return -ENOMEM;
diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_processpptables.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_processpptables.c
index 3be616af327e..2b9a1840a35a 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_processpptables.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_processpptables.c
@@ -350,8 +350,8 @@ static int get_mm_clock_voltage_table(
PP_ASSERT_WITH_CODE((mm_dependency_table->ucNumEntries != 0),
"Invalid PowerPlay Table!", return -1);
- mm_table = kzalloc(struct_size(mm_table, entries, mm_dependency_table->ucNumEntries),
- GFP_KERNEL);
+ mm_table = kzalloc_flex(*mm_table, entries,
+ mm_dependency_table->ucNumEntries, GFP_KERNEL);
if (!mm_table)
return -ENOMEM;
@@ -573,8 +573,8 @@ static int get_socclk_voltage_dependency_table(
PP_ASSERT_WITH_CODE(clk_dep_table->ucNumEntries,
"Invalid PowerPlay Table!", return -1);
- clk_table = kzalloc(struct_size(clk_table, entries, clk_dep_table->ucNumEntries),
- GFP_KERNEL);
+ clk_table = kzalloc_flex(*clk_table, entries,
+ clk_dep_table->ucNumEntries, GFP_KERNEL);
if (!clk_table)
return -ENOMEM;
@@ -603,8 +603,8 @@ static int get_mclk_voltage_dependency_table(
PP_ASSERT_WITH_CODE(mclk_dep_table->ucNumEntries,
"Invalid PowerPlay Table!", return -1);
- mclk_table = kzalloc(struct_size(mclk_table, entries, mclk_dep_table->ucNumEntries),
- GFP_KERNEL);
+ mclk_table = kzalloc_flex(*mclk_table, entries,
+ mclk_dep_table->ucNumEntries, GFP_KERNEL);
if (!mclk_table)
return -ENOMEM;
@@ -640,8 +640,8 @@ static int get_gfxclk_voltage_dependency_table(
PP_ASSERT_WITH_CODE((clk_dep_table->ucNumEntries != 0),
"Invalid PowerPlay Table!", return -1);
- clk_table = kzalloc(struct_size(clk_table, entries, clk_dep_table->ucNumEntries),
- GFP_KERNEL);
+ clk_table = kzalloc_flex(*clk_table, entries,
+ clk_dep_table->ucNumEntries, GFP_KERNEL);
if (!clk_table)
return -ENOMEM;
@@ -702,8 +702,8 @@ static int get_pix_clk_voltage_dependency_table(
PP_ASSERT_WITH_CODE((clk_dep_table->ucNumEntries != 0),
"Invalid PowerPlay Table!", return -1);
- clk_table = kzalloc(struct_size(clk_table, entries, clk_dep_table->ucNumEntries),
- GFP_KERNEL);
+ clk_table = kzalloc_flex(*clk_table, entries,
+ clk_dep_table->ucNumEntries, GFP_KERNEL);
if (!clk_table)
return -ENOMEM;
@@ -755,8 +755,7 @@ static int get_dcefclk_voltage_dependency_table(
num_entries = clk_dep_table->ucNumEntries;
- clk_table = kzalloc(struct_size(clk_table, entries, num_entries),
- GFP_KERNEL);
+ clk_table = kzalloc_flex(*clk_table, entries, num_entries, GFP_KERNEL);
if (!clk_table)
return -ENOMEM;
@@ -794,8 +793,8 @@ static int get_pcie_table(struct pp_hwmgr *hwmgr,
"Invalid PowerPlay Table!",
return 0);
- pcie_table = kzalloc(struct_size(pcie_table, entries, atom_pcie_table->ucNumEntries),
- GFP_KERNEL);
+ pcie_table = kzalloc_flex(*pcie_table, entries,
+ atom_pcie_table->ucNumEntries, GFP_KERNEL);
if (!pcie_table)
return -ENOMEM;
@@ -853,8 +852,8 @@ static int get_valid_clk(
PP_ASSERT_WITH_CODE(clk_volt_pp_table->count,
"Invalid PowerPlay Table!", return -1);
- table = kzalloc(struct_size(table, values, clk_volt_pp_table->count),
- GFP_KERNEL);
+ table = kzalloc_flex(*table, values, clk_volt_pp_table->count,
+ GFP_KERNEL);
if (!table)
return -ENOMEM;
@@ -1041,7 +1040,7 @@ static int get_vddc_lookup_table(
PP_ASSERT_WITH_CODE((vddc_lookup_pp_tables->ucNumEntries != 0),
"Invalid SOC_VDDD Lookup Table!", return 1);
- table = kzalloc(struct_size(table, entries, max_levels), GFP_KERNEL);
+ table = kzalloc_flex(*table, entries, max_levels, GFP_KERNEL);
if (!table)
return -ENOMEM;
@@ -1149,7 +1148,7 @@ static int vega10_pp_tables_initialize(struct pp_hwmgr *hwmgr)
int result = 0;
const ATOM_Vega10_POWERPLAYTABLE *powerplay_table;
- hwmgr->pptable = kzalloc(sizeof(struct phm_ppt_v2_information), GFP_KERNEL);
+ hwmgr->pptable = kzalloc_obj(struct phm_ppt_v2_information, GFP_KERNEL);
PP_ASSERT_WITH_CODE((hwmgr->pptable != NULL),
"Failed to allocate hwmgr->pptable!", return -ENOMEM);
diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_hwmgr.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_hwmgr.c
index 5a987a535e73..eca05a6c868f 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_hwmgr.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_hwmgr.c
@@ -395,7 +395,7 @@ static int vega12_hwmgr_backend_init(struct pp_hwmgr *hwmgr)
struct vega12_hwmgr *data;
struct amdgpu_device *adev = hwmgr->adev;
- data = kzalloc(sizeof(struct vega12_hwmgr), GFP_KERNEL);
+ data = kzalloc_obj(struct vega12_hwmgr, GFP_KERNEL);
if (data == NULL)
return -ENOMEM;
diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_processpptables.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_processpptables.c
index 89148f73b514..b8fad7417190 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_processpptables.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_processpptables.c
@@ -263,7 +263,7 @@ static int vega12_pp_tables_initialize(struct pp_hwmgr *hwmgr)
int result = 0;
const ATOM_Vega12_POWERPLAYTABLE *powerplay_table;
- hwmgr->pptable = kzalloc(sizeof(struct phm_ppt_v3_information), GFP_KERNEL);
+ hwmgr->pptable = kzalloc_obj(struct phm_ppt_v3_information, GFP_KERNEL);
PP_ASSERT_WITH_CODE((hwmgr->pptable != NULL),
"Failed to allocate hwmgr->pptable!", return -ENOMEM);
diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c
index 5193b7d0e11b..1dc84beaf440 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c
@@ -436,7 +436,7 @@ static int vega20_hwmgr_backend_init(struct pp_hwmgr *hwmgr)
struct amdgpu_device *adev = hwmgr->adev;
int result;
- data = kzalloc(sizeof(struct vega20_hwmgr), GFP_KERNEL);
+ data = kzalloc_obj(struct vega20_hwmgr, GFP_KERNEL);
if (data == NULL)
return -ENOMEM;
diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_processpptables.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_processpptables.c
index 2b446f8866ba..4316b5e4b848 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_processpptables.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_processpptables.c
@@ -336,7 +336,7 @@ static int vega20_pp_tables_initialize(struct pp_hwmgr *hwmgr)
int result = 0;
const ATOM_Vega20_POWERPLAYTABLE *powerplay_table;
- hwmgr->pptable = kzalloc(sizeof(struct phm_ppt_v3_information), GFP_KERNEL);
+ hwmgr->pptable = kzalloc_obj(struct phm_ppt_v3_information, GFP_KERNEL);
PP_ASSERT_WITH_CODE((hwmgr->pptable != NULL),
"Failed to allocate hwmgr->pptable!", return -ENOMEM);
diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/ci_smumgr.c b/drivers/gpu/drm/amd/pm/powerplay/smumgr/ci_smumgr.c
index ad1fd3150d03..12a699a8c954 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/smumgr/ci_smumgr.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/smumgr/ci_smumgr.c
@@ -2681,7 +2681,7 @@ static int ci_initialize_mc_reg_table(struct pp_hwmgr *hwmgr)
struct ci_mc_reg_table *ni_table = &smu_data->mc_reg_table;
uint8_t module_index = ci_get_memory_modile_index(hwmgr);
- table = kzalloc(sizeof(pp_atomctrl_mc_reg_table), GFP_KERNEL);
+ table = kzalloc_obj(pp_atomctrl_mc_reg_table, GFP_KERNEL);
if (NULL == table)
return -ENOMEM;
@@ -2735,7 +2735,7 @@ static int ci_smu_init(struct pp_hwmgr *hwmgr)
{
struct ci_smumgr *ci_priv;
- ci_priv = kzalloc(sizeof(struct ci_smumgr), GFP_KERNEL);
+ ci_priv = kzalloc_obj(struct ci_smumgr, GFP_KERNEL);
if (ci_priv == NULL)
return -ENOMEM;
diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/fiji_smumgr.c b/drivers/gpu/drm/amd/pm/powerplay/smumgr/fiji_smumgr.c
index 0a876c840c79..d7fd3a36ac95 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/smumgr/fiji_smumgr.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/smumgr/fiji_smumgr.c
@@ -334,7 +334,7 @@ static int fiji_smu_init(struct pp_hwmgr *hwmgr)
{
struct fiji_smumgr *fiji_priv;
- fiji_priv = kzalloc(sizeof(struct fiji_smumgr), GFP_KERNEL);
+ fiji_priv = kzalloc_obj(struct fiji_smumgr, GFP_KERNEL);
if (fiji_priv == NULL)
return -ENOMEM;
diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/iceland_smumgr.c b/drivers/gpu/drm/amd/pm/powerplay/smumgr/iceland_smumgr.c
index aa3ae9b115c4..b990def7d1aa 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/smumgr/iceland_smumgr.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/smumgr/iceland_smumgr.c
@@ -261,7 +261,7 @@ static int iceland_smu_init(struct pp_hwmgr *hwmgr)
{
struct iceland_smumgr *iceland_priv;
- iceland_priv = kzalloc(sizeof(struct iceland_smumgr), GFP_KERNEL);
+ iceland_priv = kzalloc_obj(struct iceland_smumgr, GFP_KERNEL);
if (iceland_priv == NULL)
return -ENOMEM;
@@ -2608,7 +2608,7 @@ static int iceland_initialize_mc_reg_table(struct pp_hwmgr *hwmgr)
struct iceland_mc_reg_table *ni_table = &smu_data->mc_reg_table;
uint8_t module_index = iceland_get_memory_modile_index(hwmgr);
- table = kzalloc(sizeof(pp_atomctrl_mc_reg_table), GFP_KERNEL);
+ table = kzalloc_obj(pp_atomctrl_mc_reg_table, GFP_KERNEL);
if (NULL == table)
return -ENOMEM;
diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c b/drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c
index bf6d09572cfc..497a70988960 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c
@@ -336,7 +336,7 @@ static int polaris10_smu_init(struct pp_hwmgr *hwmgr)
{
struct polaris10_smumgr *smu_data;
- smu_data = kzalloc(sizeof(struct polaris10_smumgr), GFP_KERNEL);
+ smu_data = kzalloc_obj(struct polaris10_smumgr, GFP_KERNEL);
if (smu_data == NULL)
return -ENOMEM;
diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu10_smumgr.c b/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu10_smumgr.c
index 38e19e5cad4d..22e0db4e097f 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu10_smumgr.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu10_smumgr.c
@@ -244,7 +244,7 @@ static int smu10_smu_init(struct pp_hwmgr *hwmgr)
struct smu10_smumgr *priv;
int r;
- priv = kzalloc(sizeof(struct smu10_smumgr), GFP_KERNEL);
+ priv = kzalloc_obj(struct smu10_smumgr, GFP_KERNEL);
if (!priv)
return -ENOMEM;
diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu7_smumgr.c b/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu7_smumgr.c
index 0d4cbe4113a0..9d6203998b5c 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu7_smumgr.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu7_smumgr.c
@@ -333,7 +333,7 @@ int smu7_request_smu_load_fw(struct pp_hwmgr *hwmgr)
if (!smu_data->toc) {
struct SMU_DRAMData_TOC *toc;
- smu_data->toc = kzalloc(sizeof(struct SMU_DRAMData_TOC), GFP_KERNEL);
+ smu_data->toc = kzalloc_obj(struct SMU_DRAMData_TOC, GFP_KERNEL);
if (!smu_data->toc)
return -ENOMEM;
toc = smu_data->toc;
diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu8_smumgr.c b/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu8_smumgr.c
index 76d4f12ceedf..82f4f466db8a 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu8_smumgr.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu8_smumgr.c
@@ -758,7 +758,7 @@ static int smu8_smu_init(struct pp_hwmgr *hwmgr)
int ret = 0;
struct smu8_smumgr *smu8_smu;
- smu8_smu = kzalloc(sizeof(struct smu8_smumgr), GFP_KERNEL);
+ smu8_smu = kzalloc_obj(struct smu8_smumgr, GFP_KERNEL);
if (smu8_smu == NULL)
return -ENOMEM;
diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/tonga_smumgr.c b/drivers/gpu/drm/amd/pm/powerplay/smumgr/tonga_smumgr.c
index 2e21f9d066cb..95d87b12df04 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/smumgr/tonga_smumgr.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/smumgr/tonga_smumgr.c
@@ -228,7 +228,7 @@ static int tonga_smu_init(struct pp_hwmgr *hwmgr)
{
struct tonga_smumgr *tonga_priv;
- tonga_priv = kzalloc(sizeof(struct tonga_smumgr), GFP_KERNEL);
+ tonga_priv = kzalloc_obj(struct tonga_smumgr, GFP_KERNEL);
if (tonga_priv == NULL)
return -ENOMEM;
@@ -3072,7 +3072,7 @@ static int tonga_initialize_mc_reg_table(struct pp_hwmgr *hwmgr)
struct tonga_mc_reg_table *ni_table = &smu_data->mc_reg_table;
uint8_t module_index = tonga_get_memory_modile_index(hwmgr);
- table = kzalloc(sizeof(pp_atomctrl_mc_reg_table), GFP_KERNEL);
+ table = kzalloc_obj(pp_atomctrl_mc_reg_table, GFP_KERNEL);
if (table == NULL)
return -ENOMEM;
diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/vega10_smumgr.c b/drivers/gpu/drm/amd/pm/powerplay/smumgr/vega10_smumgr.c
index 0bf1bf5528c2..fe960e3c1010 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/smumgr/vega10_smumgr.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/smumgr/vega10_smumgr.c
@@ -218,7 +218,7 @@ static int vega10_smu_init(struct pp_hwmgr *hwmgr)
if (ret || !info.kptr)
return -EINVAL;
- priv = kzalloc(sizeof(struct vega10_smumgr), GFP_KERNEL);
+ priv = kzalloc_obj(struct vega10_smumgr, GFP_KERNEL);
if (!priv)
return -ENOMEM;
diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/vega12_smumgr.c b/drivers/gpu/drm/amd/pm/powerplay/smumgr/vega12_smumgr.c
index e2ba593faa5d..bd846c4f09a1 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/smumgr/vega12_smumgr.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/smumgr/vega12_smumgr.c
@@ -221,7 +221,7 @@ static int vega12_smu_init(struct pp_hwmgr *hwmgr)
if (ret || !info.kptr)
return -EINVAL;
- priv = kzalloc(sizeof(struct vega12_smumgr), GFP_KERNEL);
+ priv = kzalloc_obj(struct vega12_smumgr, GFP_KERNEL);
if (!priv)
return -ENOMEM;
diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/vega20_smumgr.c b/drivers/gpu/drm/amd/pm/powerplay/smumgr/vega20_smumgr.c
index e3515156d26f..7dda3ad13861 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/smumgr/vega20_smumgr.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/smumgr/vega20_smumgr.c
@@ -430,7 +430,7 @@ static int vega20_smu_init(struct pp_hwmgr *hwmgr)
if (ret || !info.kptr)
return -EINVAL;
- priv = kzalloc(sizeof(struct vega20_smumgr), GFP_KERNEL);
+ priv = kzalloc_obj(struct vega20_smumgr, GFP_KERNEL);
if (!priv)
return -ENOMEM;
diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/vegam_smumgr.c b/drivers/gpu/drm/amd/pm/powerplay/smumgr/vegam_smumgr.c
index 34c9f59b889a..57eed236baa4 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/smumgr/vegam_smumgr.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/smumgr/vegam_smumgr.c
@@ -83,7 +83,7 @@ static int vegam_smu_init(struct pp_hwmgr *hwmgr)
{
struct vegam_smumgr *smu_data;
- smu_data = kzalloc(sizeof(struct vegam_smumgr), GFP_KERNEL);
+ smu_data = kzalloc_obj(struct vegam_smumgr, GFP_KERNEL);
if (smu_data == NULL)
return -ENOMEM;