diff options
author | Steven Rostedt (VMware) <rostedt@goodmis.org> | 2018-08-24 16:20:28 -0400 |
---|---|---|
committer | Steven Rostedt (VMware) <rostedt@goodmis.org> | 2018-09-24 04:44:52 -0400 |
commit | d6b183eda466415bb5defcf9afe4cb64734839e8 (patch) | |
tree | aea433b3c4e989293da85f71c39694580f7563fd /kernel | |
parent | 6bf4ca7fbc85d80446ac01c0d1d77db4d91a6d84 (diff) | |
download | linux-d6b183eda466415bb5defcf9afe4cb64734839e8.tar.gz linux-d6b183eda466415bb5defcf9afe4cb64734839e8.tar.bz2 linux-d6b183eda466415bb5defcf9afe4cb64734839e8.zip |
tracing/kprobe: Remove unneeded extra strchr() from create_trace_kprobe()
By utilizing a temporary variable, we can avoid adding another call to
strchr(). Instead, save the first call to a temp variable, and then use that
variable as the reference to set the event variable.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/trace/trace_kprobe.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c index c30032367aab..508396edc56a 100644 --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c @@ -749,10 +749,13 @@ static int create_trace_kprobe(int argc, char **argv) } if (event) { - if (strchr(event, '/')) { + char *slash; + + slash = strchr(event, '/'); + if (slash) { group = event; - event = strchr(group, '/') + 1; - event[-1] = '\0'; + event = slash + 1; + slash[0] = '\0'; if (strlen(group) == 0) { pr_info("Group name is not specified\n"); return -EINVAL; |