FOPEN_OR_ERR_RET(f_base_max, -1);
if (f_base_max != NULL) {
s_base_max = fgets(buf_base, sizeof(buf_base), f_base_max);
+
+ /* close the file unconditionally */
+ fclose(f_base_max);
+ f_base_max = NULL;
+
FOPS_OR_NULL_GOTO(s_base_max, out);
buf_base[BUFSIZ-1] = '\0';
base_ratio = strtoul(buf_base, NULL, POWER_CONVERT_TO_DECIMAL)
/ BUS_FREQ;
- fclose(f_base);
}
/* Add MSR read to detect turbo status */
/* Strip off terminating '\n' */
strtok(buf, "\n");
+ /* Save the original governor */
+ rte_strscpy(pi->governor_ori, buf, sizeof(pi->governor_ori));
+
/* Check if current governor is performance */
if (strncmp(buf, POWER_GOVERNOR_PERF,
sizeof(POWER_GOVERNOR_PERF)) == 0) {
"already performance\n", pi->lcore_id);
goto out;
}
- /* Save the original governor */
- strlcpy(pi->governor_ori, buf, sizeof(pi->governor_ori));
/* Write 'performance' to the governor */
val = fseek(f, 0, SEEK_SET);