diff mbox series

[2/4] libtracefs: Fix event_enable_disable() return value

Message ID 20210608135503.12135-2-y.karadz@gmail.com (mailing list archive)
State Accepted
Headers show
Series [1/4] libtracefs: Fix enable_disable_all() return value | expand

Commit Message

Yordan Karadzhov June 8, 2021, 1:55 p.m. UTC
event_enable_disable() is a static method used internally by the
tracefs_event_enable/disable() API. The returned value do not obey
the description given in the documentation. Note that "ret" must
be set to -1 right before the beginning of the loop.

Fixes: fc94d1a (libtracefs: Add tracefs_event_enable/disable() API)
Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 src/tracefs-events.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/src/tracefs-events.c b/src/tracefs-events.c
index 8b2d9ef..0fef64f 100644
--- a/src/tracefs-events.c
+++ b/src/tracefs-events.c
@@ -835,7 +835,7 @@  static int event_enable_disable(struct tracefs_instance *instance,
 	regex_t system_re, event_re;
 	char **systems;
 	char **events = NULL;
-	int ret = -1;
+	int ret;
 	int s, e;
 
 	/* Handle all events first */
@@ -860,6 +860,7 @@  static int event_enable_disable(struct tracefs_instance *instance,
 		}
 	}
 
+	ret = -1;
 	for (s = 0; systems[s]; s++) {
 		if (system && !match(systems[s], &system_re))
 			continue;