Commit bada22d0 authored by Georgiana Chelu's avatar Georgiana Chelu Committed by Alex Deucher

drm/amd/powerplay: Don't cast kzalloc() return value

The kzalloc function returns a void pointer and the assignment
operator converts it to the type of pointer it is assigned to.
Therefore, there is no need to cast.

Issue found by alloc_cast.cocci:
* WARNING: casting value returned by memory allocation function
to <struct type> is useless.

Path to the cocci script: scripts/coccinelle/api/alloc/alloc_cast.cocci
Signed-off-by: default avatarGeorgiana Chelu <georgiana.chelu93@gmail.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent d2d7cc33
...@@ -291,8 +291,7 @@ static int get_mm_clock_voltage_table( ...@@ -291,8 +291,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 (!mm_table) if (!mm_table)
return -ENOMEM; return -ENOMEM;
...@@ -519,8 +518,7 @@ static int get_socclk_voltage_dependency_table( ...@@ -519,8 +518,7 @@ static int get_socclk_voltage_dependency_table(
sizeof(phm_ppt_v1_clock_voltage_dependency_record) * sizeof(phm_ppt_v1_clock_voltage_dependency_record) *
clk_dep_table->ucNumEntries; clk_dep_table->ucNumEntries;
clk_table = (phm_ppt_v1_clock_voltage_dependency_table *) clk_table = kzalloc(table_size, GFP_KERNEL);
kzalloc(table_size, GFP_KERNEL);
if (!clk_table) if (!clk_table)
return -ENOMEM; return -ENOMEM;
...@@ -554,8 +552,7 @@ static int get_mclk_voltage_dependency_table( ...@@ -554,8 +552,7 @@ static int get_mclk_voltage_dependency_table(
sizeof(phm_ppt_v1_clock_voltage_dependency_record) * 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 (!mclk_table) if (!mclk_table)
return -ENOMEM; return -ENOMEM;
...@@ -596,8 +593,7 @@ static int get_gfxclk_voltage_dependency_table( ...@@ -596,8 +593,7 @@ static int get_gfxclk_voltage_dependency_table(
sizeof(phm_ppt_v1_clock_voltage_dependency_record) * sizeof(phm_ppt_v1_clock_voltage_dependency_record) *
clk_dep_table->ucNumEntries; clk_dep_table->ucNumEntries;
clk_table = (struct phm_ppt_v1_clock_voltage_dependency_table *) clk_table = kzalloc(table_size, GFP_KERNEL);
kzalloc(table_size, GFP_KERNEL);
if (!clk_table) if (!clk_table)
return -ENOMEM; return -ENOMEM;
...@@ -663,8 +659,7 @@ static int get_pix_clk_voltage_dependency_table( ...@@ -663,8 +659,7 @@ static int get_pix_clk_voltage_dependency_table(
sizeof(phm_ppt_v1_clock_voltage_dependency_record) * sizeof(phm_ppt_v1_clock_voltage_dependency_record) *
clk_dep_table->ucNumEntries; clk_dep_table->ucNumEntries;
clk_table = (struct phm_ppt_v1_clock_voltage_dependency_table *) clk_table = kzalloc(table_size, GFP_KERNEL);
kzalloc(table_size, GFP_KERNEL);
if (!clk_table) if (!clk_table)
return -ENOMEM; return -ENOMEM;
...@@ -728,8 +723,7 @@ static int get_dcefclk_voltage_dependency_table( ...@@ -728,8 +723,7 @@ static int get_dcefclk_voltage_dependency_table(
sizeof(phm_ppt_v1_clock_voltage_dependency_record) * sizeof(phm_ppt_v1_clock_voltage_dependency_record) *
num_entries; num_entries;
clk_table = (struct phm_ppt_v1_clock_voltage_dependency_table *) clk_table = kzalloc(table_size, GFP_KERNEL);
kzalloc(table_size, GFP_KERNEL);
if (!clk_table) if (!clk_table)
return -ENOMEM; return -ENOMEM;
...@@ -772,8 +766,7 @@ static int get_pcie_table(struct pp_hwmgr *hwmgr, ...@@ -772,8 +766,7 @@ static int get_pcie_table(struct pp_hwmgr *hwmgr,
sizeof(struct phm_ppt_v1_pcie_record) * sizeof(struct phm_ppt_v1_pcie_record) *
atom_pcie_table->ucNumEntries; atom_pcie_table->ucNumEntries;
pcie_table = (struct phm_ppt_v1_pcie_table *) pcie_table = kzalloc(table_size, GFP_KERNEL);
kzalloc(table_size, GFP_KERNEL);
if (!pcie_table) if (!pcie_table)
return -ENOMEM; return -ENOMEM;
...@@ -1026,8 +1019,7 @@ static int get_vddc_lookup_table( ...@@ -1026,8 +1019,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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment