forked from Minki/linux
drivers/amdgpu: Remove redundant casts on kzalloc() calls
Found-by: Coccinelle Signed-off-by: Edward O'Callaghan <funfunctor@folklore1984.net> Reviewed-by: Tom St Denis <tom.stdenis@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
a698e41782
commit
5969a8c76b
@ -534,7 +534,7 @@ int phm_initializa_dynamic_state_adjustment_rule_settings(struct pp_hwmgr *hwmgr
|
|||||||
|
|
||||||
/* initialize vddc_dep_on_dal_pwrl table */
|
/* initialize vddc_dep_on_dal_pwrl table */
|
||||||
table_size = sizeof(uint32_t) + 4 * sizeof(struct phm_clock_voltage_dependency_record);
|
table_size = sizeof(uint32_t) + 4 * sizeof(struct phm_clock_voltage_dependency_record);
|
||||||
table_clk_vlt = (struct phm_clock_voltage_dependency_table *)kzalloc(table_size, GFP_KERNEL);
|
table_clk_vlt = kzalloc(table_size, GFP_KERNEL);
|
||||||
|
|
||||||
if (NULL == table_clk_vlt) {
|
if (NULL == table_clk_vlt) {
|
||||||
printk(KERN_ERR "[ powerplay ] Can not allocate space for vddc_dep_on_dal_pwrl! \n");
|
printk(KERN_ERR "[ powerplay ] Can not allocate space for vddc_dep_on_dal_pwrl! \n");
|
||||||
|
@ -3260,7 +3260,7 @@ int tonga_initializa_dynamic_state_adjustment_rule_settings(struct pp_hwmgr *hwm
|
|||||||
|
|
||||||
/* initialize vddc_dep_on_dal_pwrl table */
|
/* initialize vddc_dep_on_dal_pwrl table */
|
||||||
table_size = sizeof(uint32_t) + 4 * sizeof(struct phm_clock_voltage_dependency_record);
|
table_size = sizeof(uint32_t) + 4 * sizeof(struct phm_clock_voltage_dependency_record);
|
||||||
table_clk_vlt = (struct phm_clock_voltage_dependency_table *)kzalloc(table_size, GFP_KERNEL);
|
table_clk_vlt = kzalloc(table_size, GFP_KERNEL);
|
||||||
|
|
||||||
if (NULL == table_clk_vlt) {
|
if (NULL == table_clk_vlt) {
|
||||||
printk(KERN_ERR "[ powerplay ] Can not allocate space for vddc_dep_on_dal_pwrl! \n");
|
printk(KERN_ERR "[ powerplay ] Can not allocate space for vddc_dep_on_dal_pwrl! \n");
|
||||||
|
@ -167,8 +167,7 @@ static int get_vddc_lookup_table(
|
|||||||
table_size = sizeof(uint32_t) +
|
table_size = sizeof(uint32_t) +
|
||||||
sizeof(phm_ppt_v1_voltage_lookup_record) * max_levels;
|
sizeof(phm_ppt_v1_voltage_lookup_record) * max_levels;
|
||||||
|
|
||||||
table = (phm_ppt_v1_voltage_lookup_table *)
|
table = kzalloc(table_size, GFP_KERNEL);
|
||||||
kzalloc(table_size, GFP_KERNEL);
|
|
||||||
|
|
||||||
if (NULL == table)
|
if (NULL == table)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
@ -327,7 +326,7 @@ static int get_valid_clk(
|
|||||||
table_size = sizeof(uint32_t) +
|
table_size = sizeof(uint32_t) +
|
||||||
sizeof(uint32_t) * clk_volt_pp_table->count;
|
sizeof(uint32_t) * clk_volt_pp_table->count;
|
||||||
|
|
||||||
table = (struct phm_clock_array *)kzalloc(table_size, GFP_KERNEL);
|
table = kzalloc(table_size, GFP_KERNEL);
|
||||||
|
|
||||||
if (NULL == table)
|
if (NULL == table)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
@ -377,8 +376,7 @@ static int get_mclk_voltage_dependency_table(
|
|||||||
table_size = sizeof(uint32_t) + sizeof(phm_ppt_v1_clock_voltage_dependency_record)
|
table_size = sizeof(uint32_t) + sizeof(phm_ppt_v1_clock_voltage_dependency_record)
|
||||||
* mclk_dep_table->ucNumEntries;
|
* mclk_dep_table->ucNumEntries;
|
||||||
|
|
||||||
mclk_table = (phm_ppt_v1_clock_voltage_dependency_table *)
|
mclk_table = kzalloc(table_size, GFP_KERNEL);
|
||||||
kzalloc(table_size, GFP_KERNEL);
|
|
||||||
|
|
||||||
if (NULL == mclk_table)
|
if (NULL == mclk_table)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
@ -424,8 +422,7 @@ static int get_sclk_voltage_dependency_table(
|
|||||||
table_size = sizeof(uint32_t) + sizeof(phm_ppt_v1_clock_voltage_dependency_record)
|
table_size = sizeof(uint32_t) + sizeof(phm_ppt_v1_clock_voltage_dependency_record)
|
||||||
* tonga_table->ucNumEntries;
|
* tonga_table->ucNumEntries;
|
||||||
|
|
||||||
sclk_table = (phm_ppt_v1_clock_voltage_dependency_table *)
|
sclk_table = kzalloc(table_size, GFP_KERNEL);
|
||||||
kzalloc(table_size, GFP_KERNEL);
|
|
||||||
|
|
||||||
if (NULL == sclk_table)
|
if (NULL == sclk_table)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
@ -456,8 +453,7 @@ static int get_sclk_voltage_dependency_table(
|
|||||||
table_size = sizeof(uint32_t) + sizeof(phm_ppt_v1_clock_voltage_dependency_record)
|
table_size = sizeof(uint32_t) + sizeof(phm_ppt_v1_clock_voltage_dependency_record)
|
||||||
* polaris_table->ucNumEntries;
|
* polaris_table->ucNumEntries;
|
||||||
|
|
||||||
sclk_table = (phm_ppt_v1_clock_voltage_dependency_table *)
|
sclk_table = kzalloc(table_size, GFP_KERNEL);
|
||||||
kzalloc(table_size, GFP_KERNEL);
|
|
||||||
|
|
||||||
if (NULL == sclk_table)
|
if (NULL == sclk_table)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
@ -504,7 +500,7 @@ static int get_pcie_table(
|
|||||||
table_size = sizeof(uint32_t) +
|
table_size = sizeof(uint32_t) +
|
||||||
sizeof(phm_ppt_v1_pcie_record) * atom_pcie_table->ucNumEntries;
|
sizeof(phm_ppt_v1_pcie_record) * atom_pcie_table->ucNumEntries;
|
||||||
|
|
||||||
pcie_table = (phm_ppt_v1_pcie_table *)kzalloc(table_size, GFP_KERNEL);
|
pcie_table = kzalloc(table_size, GFP_KERNEL);
|
||||||
|
|
||||||
if (pcie_table == NULL)
|
if (pcie_table == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
@ -541,7 +537,7 @@ static int get_pcie_table(
|
|||||||
table_size = sizeof(uint32_t) +
|
table_size = sizeof(uint32_t) +
|
||||||
sizeof(phm_ppt_v1_pcie_record) * atom_pcie_table->ucNumEntries;
|
sizeof(phm_ppt_v1_pcie_record) * atom_pcie_table->ucNumEntries;
|
||||||
|
|
||||||
pcie_table = (phm_ppt_v1_pcie_table *)kzalloc(table_size, GFP_KERNEL);
|
pcie_table = kzalloc(table_size, GFP_KERNEL);
|
||||||
|
|
||||||
if (pcie_table == NULL)
|
if (pcie_table == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
@ -695,8 +691,7 @@ static int get_mm_clock_voltage_table(
|
|||||||
table_size = sizeof(uint32_t) +
|
table_size = sizeof(uint32_t) +
|
||||||
sizeof(phm_ppt_v1_mm_clock_voltage_dependency_record)
|
sizeof(phm_ppt_v1_mm_clock_voltage_dependency_record)
|
||||||
* mm_dependency_table->ucNumEntries;
|
* mm_dependency_table->ucNumEntries;
|
||||||
mm_table = (phm_ppt_v1_mm_clock_voltage_dependency_table *)
|
mm_table = kzalloc(table_size, GFP_KERNEL);
|
||||||
kzalloc(table_size, GFP_KERNEL);
|
|
||||||
|
|
||||||
if (NULL == mm_table)
|
if (NULL == mm_table)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
Loading…
Reference in New Issue
Block a user