X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_power%2Fpower_pstate_cpufreq.c;h=9c1a1625fb32536e74c717f9195f248f5e0dec02;hb=a76e869f663a8ab0fe1d5a8a5bbd4caf522b0738;hp=0f8e8f9706b53443f8e352b71ea4f045eb9beb27;hpb=de394915dfa12628fd55680dadeda521e53ef948;p=dpdk.git diff --git a/lib/librte_power/power_pstate_cpufreq.c b/lib/librte_power/power_pstate_cpufreq.c index 0f8e8f9706..9c1a1625fb 100644 --- a/lib/librte_power/power_pstate_cpufreq.c +++ b/lib/librte_power/power_pstate_cpufreq.c @@ -160,6 +160,9 @@ power_init_for_setting_freq(struct pstate_power_info *pi) pi->lcore_id); f_max = fopen(fullpath_max, "rw+"); + if (f_max == NULL) + fclose(f_min); + FOPEN_OR_ERR_RET(f_max, -1); pi->f_cur_min = f_min; @@ -398,6 +401,9 @@ power_get_available_freqs(struct pstate_power_info *pi) FOPEN_OR_ERR_RET(f_min, ret); f_max = fopen(fullpath_max, "r"); + if (f_max == NULL) + fclose(f_min); + FOPEN_OR_ERR_RET(f_max, ret); s_min = fgets(buf_min, sizeof(buf_min), f_min); @@ -581,7 +587,12 @@ power_pstate_cpufreq_freqs(unsigned int lcore_id, uint32_t *freqs, uint32_t num) if (lcore_id >= RTE_MAX_LCORE) { RTE_LOG(ERR, POWER, "Invalid lcore ID\n"); - return -1; + return 0; + } + + if (freqs == NULL) { + RTE_LOG(ERR, POWER, "NULL buffer supplied\n"); + return 0; } pi = &lcore_power_info[lcore_id];