tracing: Fix return value of ftrace_raw_output_prep()
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>
Fri, 14 Nov 2014 16:42:06 +0000 (11:42 -0500)
committerSteven Rostedt <rostedt@goodmis.org>
Wed, 19 Nov 2014 20:25:48 +0000 (15:25 -0500)
If the trace_seq of ftrace_raw_output_prep() is full this function
returns TRACE_TYPE_PARTIAL_LINE, otherwise it returns zero.

The problem is that TRACE_TYPE_PARTIAL_LINE happens to be zero!

The thing is, the caller of ftrace_raw_output_prep() expects a
success to be zero. Change that to expect it to be
TRACE_TYPE_HANDLED.

Link: http://lkml.kernel.org/r/20141114112522.GA2988@dhcp128.suse.cz
Reminded-by: Petr Mladek <pmladek@suse.cz>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
include/trace/ftrace.h
kernel/trace/trace_output.c

index f13471b5d27ad8b061ed117d1a87e30de3e1e01c..139b5067345b2ecb2daa1881d8b484ad76cf382a 100644 (file)
@@ -277,7 +277,7 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags,    \
        field = (typeof(field))iter->ent;                               \
                                                                        \
        ret = ftrace_raw_output_prep(iter, trace_event);                \
-       if (ret)                                                        \
+       if (ret != TRACE_TYPE_HANDLED)                                  \
                return ret;                                             \
                                                                        \
        trace_seq_printf(s, print);                                     \
index 163c11b6b8ff5490893afa678064266919341ef2..723818bc83b48411e3c95fa876a9d025dad47c09 100644 (file)
@@ -196,10 +196,7 @@ int ftrace_raw_output_prep(struct trace_iterator *iter,
        trace_seq_init(p);
        trace_seq_printf(s, "%s: ", ftrace_event_name(event));
 
-       if (trace_seq_has_overflowed(s))
-               return TRACE_TYPE_PARTIAL_LINE;
-
-       return 0;
+       return trace_handle_return(s);
 }
 EXPORT_SYMBOL(ftrace_raw_output_prep);