Skip to contentSkip to conversation

tracing: Use str_has_prefix() in synth_event_create()

PATCH New Tom Zanussi 1 participant 1 message Jan 9, 2019 Tracing

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tracing: Use str_has_prefix() in synth_event_create()

Since we now have a str_has_prefix() that returns the length, we can use that instead of explicitly calculating it.

---
 kernel/trace/trace_events_hist.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/trace/trace_events_hist.c +1 -2
index 449d90cfa151..625725ae262f 100644
@@ -1200,8 +1200,7 @@ static int synth_event_create(int argc, const char **argv)
 
 	/* This interface accepts group name prefix */
 	if (strchr(name, '/')) {
-		len = sizeof(SYNTH_SYSTEM "/") - 1;
-		if (strncmp(name, SYNTH_SYSTEM "/", len))
+		if ((len = str_has_prefix(name, SYNTH_SYSTEM "/")) == 0)
 			return -EINVAL;
 		name += len;
 	}
Signature · 1 line
2.14.1