diff options
author | Edward O'Callaghan <funfunctor@folklore1984.net> | 2016-07-11 20:17:55 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2016-07-29 14:36:50 -0400 |
commit | 5969a8c76bc2d9b6348ab9e1cb02307805e94330 (patch) | |
tree | 88c5528afa7c29c883cf51b08d558632c9fc2744 /drivers | |
parent | a698e41782dfa223b1f929152d24821af3fbea56 (diff) |
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c | 21 |
3 files changed, 10 insertions, 15 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c index 03b6128ebc20..27e07624ac28 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c | |||
@@ -534,7 +534,7 @@ int phm_initializa_dynamic_state_adjustment_rule_settings(struct pp_hwmgr *hwmgr | |||
534 | 534 | ||
535 | /* initialize vddc_dep_on_dal_pwrl table */ | 535 | /* initialize vddc_dep_on_dal_pwrl table */ |
536 | table_size = sizeof(uint32_t) + 4 * sizeof(struct phm_clock_voltage_dependency_record); | 536 | table_size = sizeof(uint32_t) + 4 * sizeof(struct phm_clock_voltage_dependency_record); |
537 | table_clk_vlt = (struct phm_clock_voltage_dependency_table *)kzalloc(table_size, GFP_KERNEL); | 537 | table_clk_vlt = kzalloc(table_size, GFP_KERNEL); |
538 | 538 | ||
539 | if (NULL == table_clk_vlt) { | 539 | if (NULL == table_clk_vlt) { |
540 | printk(KERN_ERR "[ powerplay ] Can not allocate space for vddc_dep_on_dal_pwrl! \n"); | 540 | printk(KERN_ERR "[ powerplay ] Can not allocate space for vddc_dep_on_dal_pwrl! \n"); |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c index 01831082bbb6..6e42b470d57d 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c | |||
@@ -3260,7 +3260,7 @@ int tonga_initializa_dynamic_state_adjustment_rule_settings(struct pp_hwmgr *hwm | |||
3260 | 3260 | ||
3261 | /* initialize vddc_dep_on_dal_pwrl table */ | 3261 | /* initialize vddc_dep_on_dal_pwrl table */ |
3262 | table_size = sizeof(uint32_t) + 4 * sizeof(struct phm_clock_voltage_dependency_record); | 3262 | table_size = sizeof(uint32_t) + 4 * sizeof(struct phm_clock_voltage_dependency_record); |
3263 | table_clk_vlt = (struct phm_clock_voltage_dependency_table *)kzalloc(table_size, GFP_KERNEL); | 3263 | table_clk_vlt = kzalloc(table_size, GFP_KERNEL); |
3264 | 3264 | ||
3265 | if (NULL == table_clk_vlt) { | 3265 | if (NULL == table_clk_vlt) { |
3266 | printk(KERN_ERR "[ powerplay ] Can not allocate space for vddc_dep_on_dal_pwrl! \n"); | 3266 | printk(KERN_ERR "[ powerplay ] Can not allocate space for vddc_dep_on_dal_pwrl! \n"); |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c index 4662d3d0b7b1..53f02c7bdec2 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c | |||
@@ -167,8 +167,7 @@ static int get_vddc_lookup_table( | |||
167 | table_size = sizeof(uint32_t) + | 167 | table_size = sizeof(uint32_t) + |
168 | sizeof(phm_ppt_v1_voltage_lookup_record) * max_levels; | 168 | sizeof(phm_ppt_v1_voltage_lookup_record) * max_levels; |
169 | 169 | ||
170 | table = (phm_ppt_v1_voltage_lookup_table *) | 170 | table = kzalloc(table_size, GFP_KERNEL); |
171 | kzalloc(table_size, GFP_KERNEL); | ||
172 | 171 | ||
173 | if (NULL == table) | 172 | if (NULL == table) |
174 | return -ENOMEM; | 173 | return -ENOMEM; |
@@ -327,7 +326,7 @@ static int get_valid_clk( | |||
327 | table_size = sizeof(uint32_t) + | 326 | table_size = sizeof(uint32_t) + |
328 | sizeof(uint32_t) * clk_volt_pp_table->count; | 327 | sizeof(uint32_t) * clk_volt_pp_table->count; |
329 | 328 | ||
330 | table = (struct phm_clock_array *)kzalloc(table_size, GFP_KERNEL); | 329 | table = kzalloc(table_size, GFP_KERNEL); |
331 | 330 | ||
332 | if (NULL == table) | 331 | if (NULL == table) |
333 | return -ENOMEM; | 332 | return -ENOMEM; |
@@ -377,8 +376,7 @@ static int get_mclk_voltage_dependency_table( | |||
377 | table_size = sizeof(uint32_t) + sizeof(phm_ppt_v1_clock_voltage_dependency_record) | 376 | table_size = sizeof(uint32_t) + sizeof(phm_ppt_v1_clock_voltage_dependency_record) |
378 | * mclk_dep_table->ucNumEntries; | 377 | * mclk_dep_table->ucNumEntries; |
379 | 378 | ||
380 | mclk_table = (phm_ppt_v1_clock_voltage_dependency_table *) | 379 | mclk_table = kzalloc(table_size, GFP_KERNEL); |
381 | kzalloc(table_size, GFP_KERNEL); | ||
382 | 380 | ||
383 | if (NULL == mclk_table) | 381 | if (NULL == mclk_table) |
384 | return -ENOMEM; | 382 | return -ENOMEM; |
@@ -424,8 +422,7 @@ static int get_sclk_voltage_dependency_table( | |||
424 | table_size = sizeof(uint32_t) + sizeof(phm_ppt_v1_clock_voltage_dependency_record) | 422 | table_size = sizeof(uint32_t) + sizeof(phm_ppt_v1_clock_voltage_dependency_record) |
425 | * tonga_table->ucNumEntries; | 423 | * tonga_table->ucNumEntries; |
426 | 424 | ||
427 | sclk_table = (phm_ppt_v1_clock_voltage_dependency_table *) | 425 | sclk_table = kzalloc(table_size, GFP_KERNEL); |
428 | kzalloc(table_size, GFP_KERNEL); | ||
429 | 426 | ||
430 | if (NULL == sclk_table) | 427 | if (NULL == sclk_table) |
431 | return -ENOMEM; | 428 | return -ENOMEM; |
@@ -456,8 +453,7 @@ static int get_sclk_voltage_dependency_table( | |||
456 | table_size = sizeof(uint32_t) + sizeof(phm_ppt_v1_clock_voltage_dependency_record) | 453 | table_size = sizeof(uint32_t) + sizeof(phm_ppt_v1_clock_voltage_dependency_record) |
457 | * polaris_table->ucNumEntries; | 454 | * polaris_table->ucNumEntries; |
458 | 455 | ||
459 | sclk_table = (phm_ppt_v1_clock_voltage_dependency_table *) | 456 | sclk_table = kzalloc(table_size, GFP_KERNEL); |
460 | kzalloc(table_size, GFP_KERNEL); | ||
461 | 457 | ||
462 | if (NULL == sclk_table) | 458 | if (NULL == sclk_table) |
463 | return -ENOMEM; | 459 | return -ENOMEM; |
@@ -504,7 +500,7 @@ static int get_pcie_table( | |||
504 | table_size = sizeof(uint32_t) + | 500 | table_size = sizeof(uint32_t) + |
505 | sizeof(phm_ppt_v1_pcie_record) * atom_pcie_table->ucNumEntries; | 501 | sizeof(phm_ppt_v1_pcie_record) * atom_pcie_table->ucNumEntries; |
506 | 502 | ||
507 | pcie_table = (phm_ppt_v1_pcie_table *)kzalloc(table_size, GFP_KERNEL); | 503 | pcie_table = kzalloc(table_size, GFP_KERNEL); |
508 | 504 | ||
509 | if (pcie_table == NULL) | 505 | if (pcie_table == NULL) |
510 | return -ENOMEM; | 506 | return -ENOMEM; |
@@ -541,7 +537,7 @@ static int get_pcie_table( | |||
541 | table_size = sizeof(uint32_t) + | 537 | table_size = sizeof(uint32_t) + |
542 | sizeof(phm_ppt_v1_pcie_record) * atom_pcie_table->ucNumEntries; | 538 | sizeof(phm_ppt_v1_pcie_record) * atom_pcie_table->ucNumEntries; |
543 | 539 | ||
544 | pcie_table = (phm_ppt_v1_pcie_table *)kzalloc(table_size, GFP_KERNEL); | 540 | pcie_table = kzalloc(table_size, GFP_KERNEL); |
545 | 541 | ||
546 | if (pcie_table == NULL) | 542 | if (pcie_table == NULL) |
547 | return -ENOMEM; | 543 | return -ENOMEM; |
@@ -695,8 +691,7 @@ static int get_mm_clock_voltage_table( | |||
695 | table_size = sizeof(uint32_t) + | 691 | table_size = sizeof(uint32_t) + |
696 | sizeof(phm_ppt_v1_mm_clock_voltage_dependency_record) | 692 | sizeof(phm_ppt_v1_mm_clock_voltage_dependency_record) |
697 | * mm_dependency_table->ucNumEntries; | 693 | * mm_dependency_table->ucNumEntries; |
698 | mm_table = (phm_ppt_v1_mm_clock_voltage_dependency_table *) | 694 | mm_table = kzalloc(table_size, GFP_KERNEL); |
699 | kzalloc(table_size, GFP_KERNEL); | ||
700 | 695 | ||
701 | if (NULL == mm_table) | 696 | if (NULL == mm_table) |
702 | return -ENOMEM; | 697 | return -ENOMEM; |