public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tracing: Use str_has_prefix() in synth_event_create()
@ 2019-01-09 19:34 Tom Zanussi
  0 siblings, 0 replies; only message in thread
From: Tom Zanussi @ 2019-01-09 19:34 UTC (permalink / raw)
  To: rostedt; +Cc: mhiramat, linux-kernel

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

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 kernel/trace/trace_events_hist.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
index 449d90cfa151..625725ae262f 100644
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -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;
 	}
-- 
2.14.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-01-09 19:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-09 19:34 [PATCH] tracing: Use str_has_prefix() in synth_event_create() Tom Zanussi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox