Skip to contentSkip to conversation

tracing/fprobe: Call trace_probe_log_set_index(0) only once in __trace_fprobe_create()

PATCH New Markus Elfring 1 participant 1 message Sep 26, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tracing/fprobe: Call trace_probe_log_set_index(0) only once in __trace_fprobe_create()

From: Markus Elfring <[email protected]>
Date: Thu, 26 Sep 2024 16:22:32 +0200

A trace_probe_log_set_index(0) call was immediately used after a condition check in this function implementation.
Thus call such a function only once instead directly before the check.

This issue was transformed by using the Coccinelle software.

---
 kernel/trace/trace_fprobe.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/trace/trace_fprobe.c +1 -2
index 62e6a8f4aae9..752d1f163258 100644
@@ -1047,13 +1047,12 @@ static int __trace_fprobe_create(int argc, const char *argv[])
 	if (ret < 0)
 		goto parse_error;
 
+	trace_probe_log_set_index(0);
 	if (!is_return && maxactive) {
-		trace_probe_log_set_index(0);
 		trace_probe_log_err(1, BAD_MAXACT_TYPE);
 		goto parse_error;
 	}
 
-	trace_probe_log_set_index(0);
 	if (event) {
 		ret = traceprobe_parse_event_name(&event, &group, gbuf,
 						  event - argv[0]);

--
2.46.1