tracing: Have the historgram use the result of str_has_prefix() for len of prefix
authorSteven Rostedt (VMware) <rostedt@goodmis.org>
Fri, 21 Dec 2018 23:40:46 +0000 (18:40 -0500)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Sun, 23 Dec 2018 03:52:09 +0000 (22:52 -0500)
As str_has_prefix() returns the length on match, we can use that for the
updating of the string pointer instead of recalculating the prefix size.

Cc: Tom Zanussi <zanussi@kernel.org>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
kernel/trace/trace_events_hist.c

index 0d878dcd1e4b02082926ba2c86341768e9e29a90..449d90cfa151a3444687672f2ffe3f2ef498824b 100644 (file)
@@ -4342,12 +4342,13 @@ static int parse_actions(struct hist_trigger_data *hist_data)
        unsigned int i;
        int ret = 0;
        char *str;
+       int len;
 
        for (i = 0; i < hist_data->attrs->n_actions; i++) {
                str = hist_data->attrs->action_str[i];
 
-               if (str_has_prefix(str, "onmatch(")) {
-                       char *action_str = str + sizeof("onmatch(") - 1;
+               if ((len = str_has_prefix(str, "onmatch("))) {
+                       char *action_str = str + len;
 
                        data = onmatch_parse(tr, action_str);
                        if (IS_ERR(data)) {
@@ -4355,8 +4356,8 @@ static int parse_actions(struct hist_trigger_data *hist_data)
                                break;
                        }
                        data->fn = action_trace;
-               } else if (str_has_prefix(str, "onmax(")) {
-                       char *action_str = str + sizeof("onmax(") - 1;
+               } else if ((len = str_has_prefix(str, "onmax("))) {
+                       char *action_str = str + len;
 
                        data = onmax_parse(action_str);
                        if (IS_ERR(data)) {