linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: [for-next][PATCH 1/5] tracing/kprobe: Remove unneeded extra strchr() from create_trace_kprobe()
Date: Wed, 26 Sep 2018 12:12:27 -0400	[thread overview]
Message-ID: <20180926161336.256685206@goodmis.org> (raw)
In-Reply-To: 20180926161226.098070917@goodmis.org

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

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>
---
 kernel/trace/trace_kprobe.c | 9 ++++++---
 1 file 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;
-- 
2.18.0



  reply	other threads:[~2018-09-26 16:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-26 16:12 [for-next][PATCH 0/5] tracing: Updates for 5.0 Steven Rostedt
2018-09-26 16:12 ` Steven Rostedt [this message]
2018-09-26 16:12 ` [for-next][PATCH 2/5] uprobes: Support SDT markers having reference count (semaphore) Steven Rostedt
2018-09-26 16:12 ` [for-next][PATCH 3/5] uprobes/sdt: Prevent multiple reference counter for same uprobe Steven Rostedt
2018-09-26 16:12 ` [for-next][PATCH 4/5] trace_uprobe/sdt: " Steven Rostedt
2018-09-26 16:12 ` [for-next][PATCH 5/5] perf probe: Support SDT markers having reference counter (semaphore) Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180926161336.256685206@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).