[for-next][PATCH 3/9] ftrace: Remove redundant strsep in mod_callback

From: Steven Rostedt
Date: Wed Oct 21 2015 - 09:39:15 EST


From: Dmitry Safonov <0x7f454c46@xxxxxxxxx>

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@xxxxxxxxx

Signed-off-by: Dmitry Safonov <0x7f454c46@xxxxxxxxx>
[ converted 'if (ret == 0)' to 'if (!ret)' ]
Signed-off-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
---
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


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/