aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRex Zhu <Rex.Zhu@amd.com>2016-01-06 03:48:38 -0500
committerAlex Deucher <alexander.deucher@amd.com>2016-01-08 15:39:23 -0500
commitc15c8d70207d467bb4312d6ac5536c101246fdc6 (patch)
tree140ef07a32acc7e2590ad28b7e716ead3b1b595e
parent75ac63dbc3b0f4d3af67a5857790749e954e2ba6 (diff)
drm/amd/powerplay: fix Smatch static checker warnings
1. return -1 instead of -ENOMEM 2. The struct type mismatch warnings. Signed-off-by: Rex Zhu <Rex.Zhu@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Ken Wang <Qingqing.Wang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c2
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/functiontables.c13
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c3
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c11
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c30
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c20
-rw-r--r--drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c2
-rw-r--r--drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c2
8 files changed, 51 insertions, 32 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c
index 6dba5bf73e52..3f3009d6b6e0 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c
@@ -914,7 +914,7 @@ static int fiji_trim_voltage_table(struct pp_hwmgr *hwmgr,
914 GFP_KERNEL); 914 GFP_KERNEL);
915 915
916 if (NULL == table) 916 if (NULL == table)
917 return -EINVAL; 917 return -ENOMEM;
918 918
919 table->mask_low = vol_table->mask_low; 919 table->mask_low = vol_table->mask_low;
920 table->phase_delay = vol_table->phase_delay; 920 table->phase_delay = vol_table->phase_delay;
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/functiontables.c b/drivers/gpu/drm/amd/powerplay/hwmgr/functiontables.c
index 5abde8f6d108..9deadabbc81c 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/functiontables.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/functiontables.c
@@ -66,7 +66,7 @@ int phm_dispatch_table(struct pp_hwmgr *hwmgr,
66 temp_storage = kzalloc(rt_table->storage_size, GFP_KERNEL); 66 temp_storage = kzalloc(rt_table->storage_size, GFP_KERNEL);
67 if (temp_storage == NULL) { 67 if (temp_storage == NULL) {
68 printk(KERN_ERR "[ powerplay ] Could not allocate table temporary storage\n"); 68 printk(KERN_ERR "[ powerplay ] Could not allocate table temporary storage\n");
69 return -1; 69 return -ENOMEM;
70 } 70 }
71 } 71 }
72 72
@@ -90,7 +90,7 @@ int phm_construct_table(struct pp_hwmgr *hwmgr,
90 90
91 if (hwmgr == NULL || master_table == NULL || rt_table == NULL) { 91 if (hwmgr == NULL || master_table == NULL || rt_table == NULL) {
92 printk(KERN_ERR "[ powerplay ] Invalid Parameter!\n"); 92 printk(KERN_ERR "[ powerplay ] Invalid Parameter!\n");
93 return -1; 93 return -EINVAL;
94 } 94 }
95 95
96 for (table_item = master_table->master_list; 96 for (table_item = master_table->master_list;
@@ -102,8 +102,9 @@ int phm_construct_table(struct pp_hwmgr *hwmgr,
102 102
103 size = (function_count + 1) * sizeof(phm_table_function); 103 size = (function_count + 1) * sizeof(phm_table_function);
104 run_time_list = kzalloc(size, GFP_KERNEL); 104 run_time_list = kzalloc(size, GFP_KERNEL);
105
105 if (NULL == run_time_list) 106 if (NULL == run_time_list)
106 return -1; 107 return -ENOMEM;
107 108
108 rtf = run_time_list; 109 rtf = run_time_list;
109 for (table_item = master_table->master_list; 110 for (table_item = master_table->master_list;
@@ -111,7 +112,7 @@ int phm_construct_table(struct pp_hwmgr *hwmgr,
111 if ((rtf - run_time_list) > function_count) { 112 if ((rtf - run_time_list) > function_count) {
112 printk(KERN_ERR "[ powerplay ] Check function results have changed\n"); 113 printk(KERN_ERR "[ powerplay ] Check function results have changed\n");
113 kfree(run_time_list); 114 kfree(run_time_list);
114 return -1; 115 return -EINVAL;
115 } 116 }
116 117
117 if ((NULL == table_item->isFunctionNeededInRuntimeTable) || 118 if ((NULL == table_item->isFunctionNeededInRuntimeTable) ||
@@ -123,7 +124,7 @@ int phm_construct_table(struct pp_hwmgr *hwmgr,
123 if ((rtf - run_time_list) > function_count) { 124 if ((rtf - run_time_list) > function_count) {
124 printk(KERN_ERR "[ powerplay ] Check function results have changed\n"); 125 printk(KERN_ERR "[ powerplay ] Check function results have changed\n");
125 kfree(run_time_list); 126 kfree(run_time_list);
126 return -1; 127 return -EINVAL;
127 } 128 }
128 129
129 *rtf = NULL; 130 *rtf = NULL;
@@ -138,7 +139,7 @@ int phm_destroy_table(struct pp_hwmgr *hwmgr,
138{ 139{
139 if (hwmgr == NULL || rt_table == NULL) { 140 if (hwmgr == NULL || rt_table == NULL) {
140 printk(KERN_ERR "[ powerplay ] Invalid Parameter\n"); 141 printk(KERN_ERR "[ powerplay ] Invalid Parameter\n");
141 return -1; 142 return -EINVAL;
142 } 143 }
143 144
144 if (NULL == rt_table->function_list) 145 if (NULL == rt_table->function_list)
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
index ca4554b402f9..5fb98aa2e719 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
@@ -111,6 +111,9 @@ int hw_init_power_state_table(struct pp_hwmgr *hwmgr)
111 111
112 hwmgr->ps = kzalloc(size * table_entries, GFP_KERNEL); 112 hwmgr->ps = kzalloc(size * table_entries, GFP_KERNEL);
113 113
114 if (hwmgr->ps == NULL)
115 return -ENOMEM;
116
114 state = hwmgr->ps; 117 state = hwmgr->ps;
115 118
116 for (i = 0; i < table_entries; i++) { 119 for (i = 0; i < table_entries; i++) {
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c b/drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c
index 8f9d705bbde2..2f1a14fe05b1 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c
@@ -1322,11 +1322,17 @@ static int get_cac_leakage_table(struct pp_hwmgr *hwmgr,
1322 struct phm_cac_leakage_table *cac_leakage_table; 1322 struct phm_cac_leakage_table *cac_leakage_table;
1323 unsigned long table_size, i; 1323 unsigned long table_size, i;
1324 1324
1325 if (hwmgr == NULL || table == NULL || ptable == NULL)
1326 return -EINVAL;
1327
1325 table_size = sizeof(ULONG) + 1328 table_size = sizeof(ULONG) +
1326 (sizeof(struct phm_cac_leakage_table) * table->ucNumEntries); 1329 (sizeof(struct phm_cac_leakage_table) * table->ucNumEntries);
1327 1330
1328 cac_leakage_table = kzalloc(table_size, GFP_KERNEL); 1331 cac_leakage_table = kzalloc(table_size, GFP_KERNEL);
1329 1332
1333 if (cac_leakage_table == NULL)
1334 return -ENOMEM;
1335
1330 cac_leakage_table->count = (ULONG)table->ucNumEntries; 1336 cac_leakage_table->count = (ULONG)table->ucNumEntries;
1331 1337
1332 for (i = 0; i < cac_leakage_table->count; i++) { 1338 for (i = 0; i < cac_leakage_table->count; i++) {
@@ -1349,7 +1355,7 @@ static int get_cac_leakage_table(struct pp_hwmgr *hwmgr,
1349static int get_platform_power_management_table(struct pp_hwmgr *hwmgr, 1355static int get_platform_power_management_table(struct pp_hwmgr *hwmgr,
1350 ATOM_PPLIB_PPM_Table *atom_ppm_table) 1356 ATOM_PPLIB_PPM_Table *atom_ppm_table)
1351{ 1357{
1352 struct phm_ppm_table *ptr = kzalloc(sizeof(ATOM_PPLIB_PPM_Table), GFP_KERNEL); 1358 struct phm_ppm_table *ptr = kzalloc(sizeof(struct phm_ppm_table), GFP_KERNEL);
1353 1359
1354 if (NULL == ptr) 1360 if (NULL == ptr)
1355 return -ENOMEM; 1361 return -ENOMEM;
@@ -1466,6 +1472,9 @@ static int init_phase_shedding_table(struct pp_hwmgr *hwmgr,
1466 1472
1467 table = kzalloc(size, GFP_KERNEL); 1473 table = kzalloc(size, GFP_KERNEL);
1468 1474
1475 if (table == NULL)
1476 return -ENOMEM;
1477
1469 table->count = (unsigned long)ptable->ucNumEntries; 1478 table->count = (unsigned long)ptable->ucNumEntries;
1470 1479
1471 for (i = 0; i < table->count; i++) { 1480 for (i = 0; i < table->count; i++) {
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c
index 3cb5d041b3cf..0b188d13364f 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c
@@ -115,9 +115,12 @@ const unsigned long PhwTonga_Magic = (unsigned long)(PHM_VIslands_Magic);
115struct tonga_power_state *cast_phw_tonga_power_state( 115struct tonga_power_state *cast_phw_tonga_power_state(
116 struct pp_hw_power_state *hw_ps) 116 struct pp_hw_power_state *hw_ps)
117{ 117{
118 if (hw_ps == NULL)
119 return NULL;
120
118 PP_ASSERT_WITH_CODE((PhwTonga_Magic == hw_ps->magic), 121 PP_ASSERT_WITH_CODE((PhwTonga_Magic == hw_ps->magic),
119 "Invalid Powerstate Type!", 122 "Invalid Powerstate Type!",
120 return NULL;); 123 return NULL);
121 124
122 return (struct tonga_power_state *)hw_ps; 125 return (struct tonga_power_state *)hw_ps;
123} 126}
@@ -125,9 +128,12 @@ struct tonga_power_state *cast_phw_tonga_power_state(
125const struct tonga_power_state *cast_const_phw_tonga_power_state( 128const struct tonga_power_state *cast_const_phw_tonga_power_state(
126 const struct pp_hw_power_state *hw_ps) 129 const struct pp_hw_power_state *hw_ps)
127{ 130{
131 if (hw_ps == NULL)
132 return NULL;
133
128 PP_ASSERT_WITH_CODE((PhwTonga_Magic == hw_ps->magic), 134 PP_ASSERT_WITH_CODE((PhwTonga_Magic == hw_ps->magic),
129 "Invalid Powerstate Type!", 135 "Invalid Powerstate Type!",
130 return NULL;); 136 return NULL);
131 137
132 return (const struct tonga_power_state *)hw_ps; 138 return (const struct tonga_power_state *)hw_ps;
133} 139}
@@ -1678,9 +1684,9 @@ static int tonga_populate_smc_uvd_level(struct pp_hwmgr *hwmgr,
1678 CONVERT_FROM_HOST_TO_SMC_UL(table->UvdLevel[count].VclkFrequency); 1684 CONVERT_FROM_HOST_TO_SMC_UL(table->UvdLevel[count].VclkFrequency);
1679 CONVERT_FROM_HOST_TO_SMC_UL(table->UvdLevel[count].DclkFrequency); 1685 CONVERT_FROM_HOST_TO_SMC_UL(table->UvdLevel[count].DclkFrequency);
1680 //CONVERT_FROM_HOST_TO_SMC_UL((uint32_t)table->UvdLevel[count].MinVoltage); 1686 //CONVERT_FROM_HOST_TO_SMC_UL((uint32_t)table->UvdLevel[count].MinVoltage);
1681 } 1687 }
1682 1688
1683 return result; 1689 return result;
1684 1690
1685} 1691}
1686 1692
@@ -1719,7 +1725,7 @@ static int tonga_populate_smc_vce_level(struct pp_hwmgr *hwmgr,
1719 PP_ASSERT_WITH_CODE((0 == result), 1725 PP_ASSERT_WITH_CODE((0 == result),
1720 "can not find divide id for VCE engine clock", return result); 1726 "can not find divide id for VCE engine clock", return result);
1721 1727
1722 table->VceLevel[count].Divider = (uint8_t)dividers.pll_post_divider; 1728 table->VceLevel[count].Divider = (uint8_t)dividers.pll_post_divider;
1723 1729
1724 CONVERT_FROM_HOST_TO_SMC_UL(table->VceLevel[count].Frequency); 1730 CONVERT_FROM_HOST_TO_SMC_UL(table->VceLevel[count].Frequency);
1725 } 1731 }
@@ -1804,7 +1810,7 @@ static int tonga_populate_smc_samu_level(struct pp_hwmgr *hwmgr,
1804 PP_ASSERT_WITH_CODE((0 == result), 1810 PP_ASSERT_WITH_CODE((0 == result),
1805 "can not find divide id for samu clock", return result); 1811 "can not find divide id for samu clock", return result);
1806 1812
1807 table->SamuLevel[count].Divider = (uint8_t)dividers.pll_post_divider; 1813 table->SamuLevel[count].Divider = (uint8_t)dividers.pll_post_divider;
1808 1814
1809 CONVERT_FROM_HOST_TO_SMC_UL(table->SamuLevel[count].Frequency); 1815 CONVERT_FROM_HOST_TO_SMC_UL(table->SamuLevel[count].Frequency);
1810 } 1816 }
@@ -1847,7 +1853,7 @@ static int tonga_calculate_mclk_params(
1847 "Error retrieving Memory Clock Parameters from VBIOS.", return result); 1853 "Error retrieving Memory Clock Parameters from VBIOS.", return result);
1848 1854
1849 /* MPLL_FUNC_CNTL setup*/ 1855 /* MPLL_FUNC_CNTL setup*/
1850 mpll_func_cntl = PHM_SET_FIELD(mpll_func_cntl, MPLL_FUNC_CNTL, BWCTRL, mpll_param.bw_ctrl); 1856 mpll_func_cntl = PHM_SET_FIELD(mpll_func_cntl, MPLL_FUNC_CNTL, BWCTRL, mpll_param.bw_ctrl);
1851 1857
1852 /* MPLL_FUNC_CNTL_1 setup*/ 1858 /* MPLL_FUNC_CNTL_1 setup*/
1853 mpll_func_cntl_1 = PHM_SET_FIELD(mpll_func_cntl_1, 1859 mpll_func_cntl_1 = PHM_SET_FIELD(mpll_func_cntl_1,
@@ -3864,6 +3870,7 @@ int tonga_copy_vbios_smc_reg_table(const pp_atomctrl_mc_reg_table *table, phw_to
3864 table->mc_reg_table_entry[i].mc_data[j]; 3870 table->mc_reg_table_entry[i].mc_data[j];
3865 } 3871 }
3866 } 3872 }
3873
3867 ni_table->num_entries = table->num_entries; 3874 ni_table->num_entries = table->num_entries;
3868 3875
3869 return 0; 3876 return 0;
@@ -3989,7 +3996,7 @@ int tonga_initialize_mc_reg_table(struct pp_hwmgr *hwmgr)
3989 table = kzalloc(sizeof(pp_atomctrl_mc_reg_table), GFP_KERNEL); 3996 table = kzalloc(sizeof(pp_atomctrl_mc_reg_table), GFP_KERNEL);
3990 3997
3991 if (NULL == table) 3998 if (NULL == table)
3992 return -1; 3999 return -ENOMEM;
3993 4000
3994 /* Program additional LP registers that are no longer programmed by VBIOS */ 4001 /* Program additional LP registers that are no longer programmed by VBIOS */
3995 cgs_write_register(hwmgr->device, mmMC_SEQ_RAS_TIMING_LP, cgs_read_register(hwmgr->device, mmMC_SEQ_RAS_TIMING)); 4002 cgs_write_register(hwmgr->device, mmMC_SEQ_RAS_TIMING_LP, cgs_read_register(hwmgr->device, mmMC_SEQ_RAS_TIMING));
@@ -5470,7 +5477,6 @@ static int tonga_generate_dpm_level_enable_mask(struct pp_hwmgr *hwmgr, const vo
5470 struct tonga_hwmgr *data = (struct tonga_hwmgr *)(hwmgr->backend); 5477 struct tonga_hwmgr *data = (struct tonga_hwmgr *)(hwmgr->backend);
5471 const struct tonga_power_state *tonga_ps = cast_const_phw_tonga_power_state(states->pnew_state); 5478 const struct tonga_power_state *tonga_ps = cast_const_phw_tonga_power_state(states->pnew_state);
5472 5479
5473
5474 result = tonga_trim_dpm_states(hwmgr, tonga_ps); 5480 result = tonga_trim_dpm_states(hwmgr, tonga_ps);
5475 if (0 != result) 5481 if (0 != result)
5476 return result; 5482 return result;
@@ -5732,7 +5738,7 @@ static int tonga_set_max_fan_pwm_output(struct pp_hwmgr *hwmgr, uint16_t us_max_
5732 if (phm_is_hw_access_blocked(hwmgr)) 5738 if (phm_is_hw_access_blocked(hwmgr))
5733 return 0; 5739 return 0;
5734 5740
5735 return (0 == smum_send_msg_to_smc_with_parameter(hwmgr->smumgr, PPSMC_MSG_SetFanPwmMax, us_max_fan_pwm) ? 0 : -EINVAL); 5741 return (0 == smum_send_msg_to_smc_with_parameter(hwmgr->smumgr, PPSMC_MSG_SetFanPwmMax, us_max_fan_pwm) ? 0 : -1);
5736} 5742}
5737 5743
5738int tonga_notify_smc_display_config_after_ps_adjustment(struct pp_hwmgr *hwmgr) 5744int tonga_notify_smc_display_config_after_ps_adjustment(struct pp_hwmgr *hwmgr)
@@ -5826,7 +5832,7 @@ static int tonga_set_max_fan_rpm_output(struct pp_hwmgr *hwmgr, uint16_t us_max_
5826 if (phm_is_hw_access_blocked(hwmgr)) 5832 if (phm_is_hw_access_blocked(hwmgr))
5827 return 0; 5833 return 0;
5828 5834
5829 return (0 == smum_send_msg_to_smc_with_parameter(hwmgr->smumgr, PPSMC_MSG_SetFanRpmMax, us_max_fan_pwm) ? 0 : -EINVAL); 5835 return (0 == smum_send_msg_to_smc_with_parameter(hwmgr->smumgr, PPSMC_MSG_SetFanRpmMax, us_max_fan_pwm) ? 0 : -1);
5830} 5836}
5831 5837
5832uint32_t tonga_get_xclk(struct pp_hwmgr *hwmgr) 5838uint32_t tonga_get_xclk(struct pp_hwmgr *hwmgr)
@@ -5962,7 +5968,7 @@ int tonga_check_states_equal(struct pp_hwmgr *hwmgr, const struct pp_hw_power_st
5962 const struct tonga_power_state *psb = cast_const_phw_tonga_power_state(pstate2); 5968 const struct tonga_power_state *psb = cast_const_phw_tonga_power_state(pstate2);
5963 int i; 5969 int i;
5964 5970
5965 if (pstate1 == NULL || pstate2 == NULL || equal == NULL) 5971 if (equal == NULL || psa == NULL || psb == NULL)
5966 return -EINVAL; 5972 return -EINVAL;
5967 5973
5968 /* If the two states don't even have the same number of performance levels they cannot be the same state. */ 5974 /* If the two states don't even have the same number of performance levels they cannot be the same state. */
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c
index ae216fe8547d..34f4bef3691f 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c
@@ -168,7 +168,7 @@ static int get_vddc_lookup_table(
168 kzalloc(table_size, GFP_KERNEL); 168 kzalloc(table_size, GFP_KERNEL);
169 169
170 if (NULL == table) 170 if (NULL == table)
171 return -1; 171 return -ENOMEM;
172 172
173 memset(table, 0x00, table_size); 173 memset(table, 0x00, table_size);
174 174
@@ -206,7 +206,7 @@ static int get_platform_power_management_table(
206 (struct phm_ppt_v1_information *)(hwmgr->pptable); 206 (struct phm_ppt_v1_information *)(hwmgr->pptable);
207 207
208 if (NULL == ptr) 208 if (NULL == ptr)
209 return -1; 209 return -ENOMEM;
210 210
211 ptr->ppm_design 211 ptr->ppm_design
212 = atom_ppm_table->ucPpmDesign; 212 = atom_ppm_table->ucPpmDesign;
@@ -327,7 +327,7 @@ static int get_valid_clk(
327 table = (struct phm_clock_array *)kzalloc(table_size, GFP_KERNEL); 327 table = (struct phm_clock_array *)kzalloc(table_size, GFP_KERNEL);
328 328
329 if (NULL == table) 329 if (NULL == table)
330 return -1; 330 return -ENOMEM;
331 331
332 memset(table, 0x00, table_size); 332 memset(table, 0x00, table_size);
333 333
@@ -378,7 +378,7 @@ static int get_mclk_voltage_dependency_table(
378 kzalloc(table_size, GFP_KERNEL); 378 kzalloc(table_size, GFP_KERNEL);
379 379
380 if (NULL == mclk_table) 380 if (NULL == mclk_table)
381 return -1; 381 return -ENOMEM;
382 382
383 memset(mclk_table, 0x00, table_size); 383 memset(mclk_table, 0x00, table_size);
384 384
@@ -421,7 +421,7 @@ static int get_sclk_voltage_dependency_table(
421 kzalloc(table_size, GFP_KERNEL); 421 kzalloc(table_size, GFP_KERNEL);
422 422
423 if (NULL == sclk_table) 423 if (NULL == sclk_table)
424 return -1; 424 return -ENOMEM;
425 425
426 memset(sclk_table, 0x00, table_size); 426 memset(sclk_table, 0x00, table_size);
427 427
@@ -464,7 +464,7 @@ static int get_pcie_table(
464 pcie_table = (phm_ppt_v1_pcie_table *)kzalloc(table_size, GFP_KERNEL); 464 pcie_table = (phm_ppt_v1_pcie_table *)kzalloc(table_size, GFP_KERNEL);
465 465
466 if (NULL == pcie_table) 466 if (NULL == pcie_table)
467 return -1; 467 return -ENOMEM;
468 468
469 memset(pcie_table, 0x00, table_size); 469 memset(pcie_table, 0x00, table_size);
470 470
@@ -506,14 +506,14 @@ static int get_cac_tdp_table(
506 tdp_table = kzalloc(table_size, GFP_KERNEL); 506 tdp_table = kzalloc(table_size, GFP_KERNEL);
507 507
508 if (NULL == tdp_table) 508 if (NULL == tdp_table)
509 return -1; 509 return -ENOMEM;
510 510
511 memset(tdp_table, 0x00, table_size); 511 memset(tdp_table, 0x00, table_size);
512 512
513 hwmgr->dyn_state.cac_dtp_table = kzalloc(table_size, GFP_KERNEL); 513 hwmgr->dyn_state.cac_dtp_table = kzalloc(table_size, GFP_KERNEL);
514 514
515 if (NULL == hwmgr->dyn_state.cac_dtp_table) 515 if (NULL == hwmgr->dyn_state.cac_dtp_table)
516 return -1; 516 return -ENOMEM;
517 517
518 memset(hwmgr->dyn_state.cac_dtp_table, 0x00, table_size); 518 memset(hwmgr->dyn_state.cac_dtp_table, 0x00, table_size);
519 519
@@ -614,7 +614,7 @@ static int get_mm_clock_voltage_table(
614 kzalloc(table_size, GFP_KERNEL); 614 kzalloc(table_size, GFP_KERNEL);
615 615
616 if (NULL == mm_table) 616 if (NULL == mm_table)
617 return -1; 617 return -ENOMEM;
618 618
619 memset(mm_table, 0x00, table_size); 619 memset(mm_table, 0x00, table_size);
620 620
@@ -943,7 +943,7 @@ int tonga_pp_tables_initialize(struct pp_hwmgr *hwmgr)
943 hwmgr->pptable = kzalloc(sizeof(struct phm_ppt_v1_information), GFP_KERNEL); 943 hwmgr->pptable = kzalloc(sizeof(struct phm_ppt_v1_information), GFP_KERNEL);
944 944
945 PP_ASSERT_WITH_CODE((NULL != hwmgr->pptable), 945 PP_ASSERT_WITH_CODE((NULL != hwmgr->pptable),
946 "Failed to allocate hwmgr->pptable!", return -1); 946 "Failed to allocate hwmgr->pptable!", return -ENOMEM);
947 947
948 memset(hwmgr->pptable, 0x00, sizeof(struct phm_ppt_v1_information)); 948 memset(hwmgr->pptable, 0x00, sizeof(struct phm_ppt_v1_information));
949 949
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c
index 21c31db0df26..cdbb9f89bf36 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c
@@ -1033,7 +1033,7 @@ int fiji_smum_init(struct pp_smumgr *smumgr)
1033 fiji_smu = kzalloc(sizeof(struct fiji_smumgr), GFP_KERNEL); 1033 fiji_smu = kzalloc(sizeof(struct fiji_smumgr), GFP_KERNEL);
1034 1034
1035 if (fiji_smu == NULL) 1035 if (fiji_smu == NULL)
1036 return -1; 1036 return -ENOMEM;
1037 1037
1038 smumgr->backend = fiji_smu; 1038 smumgr->backend = fiji_smu;
1039 smumgr->smumgr_funcs = &fiji_smu_funcs; 1039 smumgr->smumgr_funcs = &fiji_smu_funcs;
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c
index 62ff76010aa6..d166fd925dbb 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c
@@ -810,7 +810,7 @@ int tonga_smum_init(struct pp_smumgr *smumgr)
810 tonga_smu = kzalloc(sizeof(struct tonga_smumgr), GFP_KERNEL); 810 tonga_smu = kzalloc(sizeof(struct tonga_smumgr), GFP_KERNEL);
811 811
812 if (tonga_smu == NULL) 812 if (tonga_smu == NULL)
813 return -1; 813 return -ENOMEM;
814 814
815 smumgr->backend = tonga_smu; 815 smumgr->backend = tonga_smu;
816 smumgr->smumgr_funcs = &tonga_smu_funcs; 816 smumgr->smumgr_funcs = &tonga_smu_funcs;