lib: check experimental symbols with meson
[dpdk.git] / lib / librte_power / power_acpi_cpufreq.c
index 45412f0..7c386f8 100644 (file)
 #include <signal.h>
 #include <limits.h>
 
-#include <rte_memcpy.h>
 #include <rte_atomic.h>
+#include <rte_memcpy.h>
+#include <rte_memory.h>
+#include <rte_string_fns.h>
 
 #include "power_acpi_cpufreq.h"
 #include "power_common.h"
@@ -147,6 +149,8 @@ power_set_governor_userspace(struct rte_power_info *pi)
 
        s = fgets(buf, sizeof(buf), f);
        FOPS_OR_NULL_GOTO(s, out);
+       /* Strip off terminating '\n' */
+       strtok(buf, "\n");
 
        /* Check if current governor is userspace */
        if (strncmp(buf, POWER_GOVERNOR_USERSPACE,
@@ -157,7 +161,7 @@ power_set_governor_userspace(struct rte_power_info *pi)
                goto out;
        }
        /* Save the original governor */
-       snprintf(pi->governor_ori, sizeof(pi->governor_ori), "%s", buf);
+       strlcpy(pi->governor_ori, buf, sizeof(pi->governor_ori));
 
        /* Write 'userspace' to the governor */
        val = fseek(f, 0, SEEK_SET);
@@ -440,8 +444,8 @@ power_acpi_cpufreq_freqs(unsigned int lcore_id, uint32_t *freqs, uint32_t num)
 {
        struct rte_power_info *pi;
 
-       if (lcore_id >= RTE_MAX_LCORE || !freqs) {
-               RTE_LOG(ERR, POWER, "Invalid input parameter\n");
+       if (lcore_id >= RTE_MAX_LCORE) {
+               RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
                return 0;
        }