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>,
	Dmitry Safonov <0x7f454c46@gmail.com>
Subject: [for-next][PATCH 3/9] ftrace: Remove redundant strsep in mod_callback
Date: Wed, 21 Oct 2015 09:37:27 -0400	[thread overview]
Message-ID: <20151021133748.129229695@goodmis.org> (raw)
In-Reply-To: 20151021133724.211811078@goodmis.org

[-- Attachment #1: 0003-ftrace-Remove-redundant-strsep-in-mod_callback.patch --]
[-- Type: text/plain, Size: 1580 bytes --]

From: Dmitry Safonov <0x7f454c46@gmail.com>

By now there isn't any subcommand for mod.

Before:
	sh$ echo '*:mod:ipv6:a' > set_ftrace_filter
	sh$ echo '*:mod:ipv6' > set_ftrace_filter
had the same results, but now first will result in:
	sh$ echo '*:mod:ipv6:a' > set_ftrace_filter
	-bash: echo: write error: Invalid argument

Also, I clarified ftrace_mod_callback code a little.

Link: http://lkml.kernel.org/r/1443545176-3215-1-git-send-email-0x7f454c46@gmail.com

Signed-off-by: Dmitry Safonov <0x7f454c46@gmail.com>
[ converted 'if (ret == 0)' to 'if (!ret)' ]
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/ftrace.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index f7b78d75c605..8892b45b4368 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -3569,8 +3569,7 @@ static int
 ftrace_mod_callback(struct ftrace_hash *hash,
 		    char *func, char *cmd, char *param, int enable)
 {
-	char *mod;
-	int ret = -EINVAL;
+	int ret;
 
 	/*
 	 * cmd == 'mod' because we only registered this func
@@ -3581,16 +3580,12 @@ ftrace_mod_callback(struct ftrace_hash *hash,
 	 */
 
 	/* we must have a module name */
-	if (!param)
-		return ret;
-
-	mod = strsep(&param, ":");
-	if (!strlen(mod))
-		return ret;
+	if (!param || !strlen(param))
+		return -EINVAL;
 
-	ret = ftrace_match_module_records(hash, func, mod);
+	ret = ftrace_match_module_records(hash, func, param);
 	if (!ret)
-		ret = -EINVAL;
+		return -EINVAL;
 	if (ret < 0)
 		return ret;
 
-- 
2.6.1



  parent reply	other threads:[~2015-10-21 13:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-21 13:37 [for-next][PATCH 0/9] tracing: Updates for 4.4 Steven Rostedt
2015-10-21 13:37 ` [for-next][PATCH 1/9] tracing: Use kstrdup_const instead of private implementation Steven Rostedt
2015-10-21 13:37 ` [for-next][PATCH 2/9] ftrace: Remove redundant swap function Steven Rostedt
2015-10-21 13:37 ` Steven Rostedt [this message]
2015-10-21 13:37 ` [for-next][PATCH 4/9] ftrace: Clarify code for mod command Steven Rostedt
2015-10-21 13:37 ` [for-next][PATCH 5/9] ftrace: Introduce ftrace_glob structure Steven Rostedt
2015-10-21 13:37 ` [for-next][PATCH 6/9] ftrace: add module globbing Steven Rostedt
2015-10-21 13:37 ` [for-next][PATCH 7/9] Documentation: ftrace: Module globbing usage Steven Rostedt
2015-10-21 13:37 ` [for-next][PATCH 8/9] tracing: Allow disabling compilation of specific trace systems Steven Rostedt
2015-10-21 13:37 ` [for-next][PATCH 9/9] tracing: gpio: Add Kconfig option for enabling/disabling trace events 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=20151021133748.129229695@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=0x7f454c46@gmail.com \
    --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).