DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/2] power: fix power management env detection
@ 2020-07-13 12:15 Anatoly Burakov
  2020-07-13 12:15 ` [dpdk-dev] [PATCH 2/2] l3fwd-power: fix updating performance lcore parameters Anatoly Burakov
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Anatoly Burakov @ 2020-07-13 12:15 UTC (permalink / raw)
  To: dev; +Cc: David Hunt, reshma.pattan

Anything coming from sysfs has a newline at the end. Cut it off before
comparing the strings.

Fixes: 20ab67608a39 ("power: add environment capability probing")

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 lib/librte_power/power_common.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/librte_power/power_common.c b/lib/librte_power/power_common.c
index 59023d986b..fd527719cd 100644
--- a/lib/librte_power/power_common.c
+++ b/lib/librte_power/power_common.c
@@ -15,6 +15,7 @@ int
 cpufreq_check_scaling_driver(const char *driver_name)
 {
 	unsigned int lcore_id = 0; /* always check core 0 */
+	size_t len;
 	char fullpath[PATH_MAX];
 	char readbuf[PATH_MAX];
 	char *s;
@@ -39,6 +40,10 @@ cpufreq_check_scaling_driver(const char *driver_name)
 	if (s == NULL)
 		return 0;
 
+	/* when read from sysfs, driver name has an extra newline at the end */
+	len = strnlen(readbuf, sizeof(readbuf));
+	readbuf[len - 1] = '\0';
+
 	/* does the driver name match? */
 	if (strncmp(readbuf, driver_name, sizeof(readbuf)) != 0)
 		return 0;
-- 
2.17.1

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-07-21 23:57 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-13 12:15 [dpdk-dev] [PATCH 1/2] power: fix power management env detection Anatoly Burakov
2020-07-13 12:15 ` [dpdk-dev] [PATCH 2/2] l3fwd-power: fix updating performance lcore parameters Anatoly Burakov
2020-07-13 12:29   ` Hunt, David
2020-07-13 12:26 ` [dpdk-dev] [PATCH 1/2] power: fix power management env detection Hunt, David
2020-07-13 14:54 ` [dpdk-dev] [PATCH v2 " Anatoly Burakov
2020-07-13 15:33   ` Bruce Richardson
2020-07-14  9:34     ` Burakov, Anatoly
2020-07-14 10:30   ` [dpdk-dev] [PATCH v3 " Anatoly Burakov
2020-07-15  4:18     ` Ma, LihongX
2020-07-17 12:50     ` Bruce Richardson
2020-07-21 23:57       ` Thomas Monjalon
2020-07-14 10:30   ` [dpdk-dev] [PATCH v3 2/2] l3fwd-power: fix updating performance lcore parameters Anatoly Burakov
2020-07-13 14:54 ` [dpdk-dev] [PATCH v2 " Anatoly Burakov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).