cryptodev: remove XTS comment duplication
[dpdk.git] / lib / librte_power / power_pstate_cpufreq.c
index 0f8e8f9..9c1a162 100644 (file)
@@ -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];