diff options
author | Dmitry Safonov <0x7f454c46@gmail.com> | 2015-09-29 12:46:12 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2015-10-13 20:59:24 -0400 |
commit | 5e3949f0ac5a81a1b06a5d972085cbf1aaf17508 (patch) | |
tree | abe33b7432a9d29514000ae95b70a4688cd908ab | |
parent | 6db0290322101f971d6c06ee652d9838f3f4ee92 (diff) |
ftrace: Remove redundant strsep in mod_callback
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>
-rw-r--r-- | kernel/trace/ftrace.c | 15 |
1 files 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 | |||
3569 | ftrace_mod_callback(struct ftrace_hash *hash, | 3569 | ftrace_mod_callback(struct ftrace_hash *hash, |
3570 | char *func, char *cmd, char *param, int enable) | 3570 | char *func, char *cmd, char *param, int enable) |
3571 | { | 3571 | { |
3572 | char *mod; | 3572 | int ret; |
3573 | int ret = -EINVAL; | ||
3574 | 3573 | ||
3575 | /* | 3574 | /* |
3576 | * cmd == 'mod' because we only registered this func | 3575 | * cmd == 'mod' because we only registered this func |
@@ -3581,16 +3580,12 @@ ftrace_mod_callback(struct ftrace_hash *hash, | |||
3581 | */ | 3580 | */ |
3582 | 3581 | ||
3583 | /* we must have a module name */ | 3582 | /* we must have a module name */ |
3584 | if (!param) | 3583 | if (!param || !strlen(param)) |
3585 | return ret; | 3584 | return -EINVAL; |
3586 | |||
3587 | mod = strsep(¶m, ":"); | ||
3588 | if (!strlen(mod)) | ||
3589 | return ret; | ||
3590 | 3585 | ||
3591 | ret = ftrace_match_module_records(hash, func, mod); | 3586 | ret = ftrace_match_module_records(hash, func, param); |
3592 | if (!ret) | 3587 | if (!ret) |
3593 | ret = -EINVAL; | 3588 | return -EINVAL; |
3594 | if (ret < 0) | 3589 | if (ret < 0) |
3595 | return ret; | 3590 | return ret; |
3596 | 3591 | ||