GFP_KERNEL);
if (NULL == table)
- return -EINVAL;
+ return -ENOMEM;
table->mask_low = vol_table->mask_low;
table->phase_delay = vol_table->phase_delay;
temp_storage = kzalloc(rt_table->storage_size, GFP_KERNEL);
if (temp_storage == NULL) {
printk(KERN_ERR "[ powerplay ] Could not allocate table temporary storage\n");
- return -1;
+ return -ENOMEM;
}
}
if (hwmgr == NULL || master_table == NULL || rt_table == NULL) {
printk(KERN_ERR "[ powerplay ] Invalid Parameter!\n");
- return -1;
+ return -EINVAL;
}
for (table_item = master_table->master_list;
size = (function_count + 1) * sizeof(phm_table_function);
run_time_list = kzalloc(size, GFP_KERNEL);
+
if (NULL == run_time_list)
- return -1;
+ return -ENOMEM;
rtf = run_time_list;
for (table_item = master_table->master_list;
if ((rtf - run_time_list) > function_count) {
printk(KERN_ERR "[ powerplay ] Check function results have changed\n");
kfree(run_time_list);
- return -1;
+ return -EINVAL;
}
if ((NULL == table_item->isFunctionNeededInRuntimeTable) ||
if ((rtf - run_time_list) > function_count) {
printk(KERN_ERR "[ powerplay ] Check function results have changed\n");
kfree(run_time_list);
- return -1;
+ return -EINVAL;
}
*rtf = NULL;
{
if (hwmgr == NULL || rt_table == NULL) {
printk(KERN_ERR "[ powerplay ] Invalid Parameter\n");
- return -1;
+ return -EINVAL;
}
if (NULL == rt_table->function_list)
hwmgr->ps = kzalloc(size * table_entries, GFP_KERNEL);
+ if (hwmgr->ps == NULL)
+ return -ENOMEM;
+
state = hwmgr->ps;
for (i = 0; i < table_entries; i++) {
struct phm_cac_leakage_table *cac_leakage_table;
unsigned long table_size, i;
+ if (hwmgr == NULL || table == NULL || ptable == NULL)
+ return -EINVAL;
+
table_size = sizeof(ULONG) +
(sizeof(struct phm_cac_leakage_table) * table->ucNumEntries);
cac_leakage_table = kzalloc(table_size, GFP_KERNEL);
+ if (cac_leakage_table == NULL)
+ return -ENOMEM;
+
cac_leakage_table->count = (ULONG)table->ucNumEntries;
for (i = 0; i < cac_leakage_table->count; i++) {
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(ATOM_PPLIB_PPM_Table), GFP_KERNEL);
+ struct phm_ppm_table *ptr = kzalloc(sizeof(struct phm_ppm_table), GFP_KERNEL);
if (NULL == ptr)
return -ENOMEM;
table = kzalloc(size, GFP_KERNEL);
+ if (table == NULL)
+ return -ENOMEM;
+
table->count = (unsigned long)ptable->ucNumEntries;
for (i = 0; i < table->count; i++) {
struct tonga_power_state *cast_phw_tonga_power_state(
struct pp_hw_power_state *hw_ps)
{
+ if (hw_ps == NULL)
+ return NULL;
+
PP_ASSERT_WITH_CODE((PhwTonga_Magic == hw_ps->magic),
"Invalid Powerstate Type!",
- return NULL;);
+ return NULL);
return (struct tonga_power_state *)hw_ps;
}
const struct tonga_power_state *cast_const_phw_tonga_power_state(
const struct pp_hw_power_state *hw_ps)
{
+ if (hw_ps == NULL)
+ return NULL;
+
PP_ASSERT_WITH_CODE((PhwTonga_Magic == hw_ps->magic),
"Invalid Powerstate Type!",
- return NULL;);
+ return NULL);
return (const struct tonga_power_state *)hw_ps;
}
CONVERT_FROM_HOST_TO_SMC_UL(table->UvdLevel[count].VclkFrequency);
CONVERT_FROM_HOST_TO_SMC_UL(table->UvdLevel[count].DclkFrequency);
//CONVERT_FROM_HOST_TO_SMC_UL((uint32_t)table->UvdLevel[count].MinVoltage);
- }
+ }
- return result;
+ return result;
}
PP_ASSERT_WITH_CODE((0 == result),
"can not find divide id for VCE engine clock", return result);
- table->VceLevel[count].Divider = (uint8_t)dividers.pll_post_divider;
+ table->VceLevel[count].Divider = (uint8_t)dividers.pll_post_divider;
CONVERT_FROM_HOST_TO_SMC_UL(table->VceLevel[count].Frequency);
}
PP_ASSERT_WITH_CODE((0 == result),
"can not find divide id for samu clock", return result);
- table->SamuLevel[count].Divider = (uint8_t)dividers.pll_post_divider;
+ table->SamuLevel[count].Divider = (uint8_t)dividers.pll_post_divider;
CONVERT_FROM_HOST_TO_SMC_UL(table->SamuLevel[count].Frequency);
}
"Error retrieving Memory Clock Parameters from VBIOS.", return result);
/* MPLL_FUNC_CNTL setup*/
- mpll_func_cntl = PHM_SET_FIELD(mpll_func_cntl, MPLL_FUNC_CNTL, BWCTRL, mpll_param.bw_ctrl);
+ mpll_func_cntl = PHM_SET_FIELD(mpll_func_cntl, MPLL_FUNC_CNTL, BWCTRL, mpll_param.bw_ctrl);
/* MPLL_FUNC_CNTL_1 setup*/
mpll_func_cntl_1 = PHM_SET_FIELD(mpll_func_cntl_1,
table->mc_reg_table_entry[i].mc_data[j];
}
}
+
ni_table->num_entries = table->num_entries;
return 0;
table = kzalloc(sizeof(pp_atomctrl_mc_reg_table), GFP_KERNEL);
if (NULL == table)
- return -1;
+ return -ENOMEM;
/* Program additional LP registers that are no longer programmed by VBIOS */
cgs_write_register(hwmgr->device, mmMC_SEQ_RAS_TIMING_LP, cgs_read_register(hwmgr->device, mmMC_SEQ_RAS_TIMING));
struct tonga_hwmgr *data = (struct tonga_hwmgr *)(hwmgr->backend);
const struct tonga_power_state *tonga_ps = cast_const_phw_tonga_power_state(states->pnew_state);
-
result = tonga_trim_dpm_states(hwmgr, tonga_ps);
if (0 != result)
return result;
if (phm_is_hw_access_blocked(hwmgr))
return 0;
- return (0 == smum_send_msg_to_smc_with_parameter(hwmgr->smumgr, PPSMC_MSG_SetFanPwmMax, us_max_fan_pwm) ? 0 : -EINVAL);
+ return (0 == smum_send_msg_to_smc_with_parameter(hwmgr->smumgr, PPSMC_MSG_SetFanPwmMax, us_max_fan_pwm) ? 0 : -1);
}
int tonga_notify_smc_display_config_after_ps_adjustment(struct pp_hwmgr *hwmgr)
if (phm_is_hw_access_blocked(hwmgr))
return 0;
- return (0 == smum_send_msg_to_smc_with_parameter(hwmgr->smumgr, PPSMC_MSG_SetFanRpmMax, us_max_fan_pwm) ? 0 : -EINVAL);
+ return (0 == smum_send_msg_to_smc_with_parameter(hwmgr->smumgr, PPSMC_MSG_SetFanRpmMax, us_max_fan_pwm) ? 0 : -1);
}
uint32_t tonga_get_xclk(struct pp_hwmgr *hwmgr)
const struct tonga_power_state *psb = cast_const_phw_tonga_power_state(pstate2);
int i;
- if (pstate1 == NULL || pstate2 == NULL || equal == NULL)
+ if (equal == NULL || psa == NULL || psb == NULL)
return -EINVAL;
/* If the two states don't even have the same number of performance levels they cannot be the same state. */
kzalloc(table_size, GFP_KERNEL);
if (NULL == table)
- return -1;
+ return -ENOMEM;
memset(table, 0x00, table_size);
(struct phm_ppt_v1_information *)(hwmgr->pptable);
if (NULL == ptr)
- return -1;
+ return -ENOMEM;
ptr->ppm_design
= atom_ppm_table->ucPpmDesign;
table = (struct phm_clock_array *)kzalloc(table_size, GFP_KERNEL);
if (NULL == table)
- return -1;
+ return -ENOMEM;
memset(table, 0x00, table_size);
kzalloc(table_size, GFP_KERNEL);
if (NULL == mclk_table)
- return -1;
+ return -ENOMEM;
memset(mclk_table, 0x00, table_size);
kzalloc(table_size, GFP_KERNEL);
if (NULL == sclk_table)
- return -1;
+ return -ENOMEM;
memset(sclk_table, 0x00, table_size);
pcie_table = (phm_ppt_v1_pcie_table *)kzalloc(table_size, GFP_KERNEL);
if (NULL == pcie_table)
- return -1;
+ return -ENOMEM;
memset(pcie_table, 0x00, table_size);
tdp_table = kzalloc(table_size, GFP_KERNEL);
if (NULL == tdp_table)
- return -1;
+ return -ENOMEM;
memset(tdp_table, 0x00, table_size);
hwmgr->dyn_state.cac_dtp_table = kzalloc(table_size, GFP_KERNEL);
if (NULL == hwmgr->dyn_state.cac_dtp_table)
- return -1;
+ return -ENOMEM;
memset(hwmgr->dyn_state.cac_dtp_table, 0x00, table_size);
kzalloc(table_size, GFP_KERNEL);
if (NULL == mm_table)
- return -1;
+ return -ENOMEM;
memset(mm_table, 0x00, table_size);
hwmgr->pptable = kzalloc(sizeof(struct phm_ppt_v1_information), GFP_KERNEL);
PP_ASSERT_WITH_CODE((NULL != hwmgr->pptable),
- "Failed to allocate hwmgr->pptable!", return -1);
+ "Failed to allocate hwmgr->pptable!", return -ENOMEM);
memset(hwmgr->pptable, 0x00, sizeof(struct phm_ppt_v1_information));
fiji_smu = kzalloc(sizeof(struct fiji_smumgr), GFP_KERNEL);
if (fiji_smu == NULL)
- return -1;
+ return -ENOMEM;
smumgr->backend = fiji_smu;
smumgr->smumgr_funcs = &fiji_smu_funcs;
tonga_smu = kzalloc(sizeof(struct tonga_smumgr), GFP_KERNEL);
if (tonga_smu == NULL)
- return -1;
+ return -ENOMEM;
smumgr->backend = tonga_smu;
smumgr->smumgr_funcs = &tonga_smu_funcs;