_E("cannot allocate memory for pass_table\n");
return -EINVAL;
}
+ /*
+ * TODO: This is a dangerous way to initialize C-style struct type
+ * pointer variables. When we refactor source code of PASS, it is
+ * required to better use consturctor functions.
+ */
+
+ if (!memset(policy->pass_table, 0,
+ sizeof(struct pass_table) * policy->num_levels)){
+ _E("cannot initialize pass_table\n");
+ return -EINVAL;
+ }
}
return 0;
policy->gov_timeout = 0;
policy->last_time = 0;
- for (level = 0; level < policy->num_levels; level++) {
- policy->pass_table[level].limit_max_freq = 0;
- policy->pass_table[level].limit_max_cpu = 0;
- policy->pass_table[level].gov_timeout = 0;
-
- policy->pass_table[level].num_down_cond = 0;
- policy->pass_table[level].down_cond[0].freq = 0;
- policy->pass_table[level].down_cond[0].nr_running = 0;
- policy->pass_table[level].down_cond[0].busy_cpu = 0;
-
- policy->pass_table[level].num_up_cond = 0;
- policy->pass_table[level].up_cond[0].freq = 0;
- policy->pass_table[level].up_cond[0].nr_running = 0;
- policy->pass_table[level].up_cond[0].busy_cpu = 0;
-
- policy->pass_table[level].num_left_cond = 0;
- policy->pass_table[level].left_cond[0].freq = 0;
- policy->pass_table[level].left_cond[0].nr_running = 0;
- policy->pass_table[level].left_cond[0].busy_cpu = 0;
-
- policy->pass_table[level].num_right_cond = 0;
- policy->pass_table[level].right_cond[0].freq = 0;
- policy->pass_table[level].right_cond[0].nr_running = 0;
- policy->pass_table[level].right_cond[0].busy_cpu = 0;
- }
-
ret = config_parse(pass_conf_path, pass_load_config, policy);
if (ret < 0) {
_E("cannot parse %s\n", pass_conf_path);