aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace
diff options
context:
space:
mode:
authorMasami Hiramatsu <mhiramat@redhat.com>2009-09-25 14:20:54 -0400
committerFrederic Weisbecker <fweisbec@gmail.com>2009-10-02 21:04:58 -0400
commit88f70d7590538e427c8405a2e02ac2624847386c (patch)
treeadfd71b017f169406ba696ea30658e3463639768 /kernel/trace
parentc0b11d3af164947c71e2491912c5b8418900dafb (diff)
tracing/ftrace: Fix to check create_event_dir() when adding new events
Check result of event_create_dir() and add ftrace_event_call to ftrace_events list only if it is succeeded. Thanks to Li for pointing it out. Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com> Acked-by: Steven Rostedt <rostedt@goodmis.org> Acked-by: Ingo Molnar <mingo@elte.hu> Cc: Jim Keniston <jkenisto@us.ibm.com> Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Christoph Hellwig <hch@infradead.org> Cc: Frank Ch. Eigler <fche@redhat.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Jason Baron <jbaron@redhat.com> Cc: K.Prasad <prasad@linux.vnet.ibm.com> Cc: Lai Jiangshan <laijs@cn.fujitsu.com> Cc: Li Zefan <lizf@cn.fujitsu.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com> Cc: Tom Zanussi <tzanussi@gmail.com> LKML-Reference: <20090925182054.10157.55219.stgit@omoto> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Diffstat (limited to 'kernel/trace')
-rw-r--r--kernel/trace/trace_events.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index a4b7c9a9130c..155b5d5a4e45 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -957,12 +957,12 @@ static int __trace_add_event_call(struct ftrace_event_call *call)
957 if (!d_events) 957 if (!d_events)
958 return -ENOENT; 958 return -ENOENT;
959 959
960 list_add(&call->list, &ftrace_events);
961 ret = event_create_dir(call, d_events, &ftrace_event_id_fops, 960 ret = event_create_dir(call, d_events, &ftrace_event_id_fops,
962 &ftrace_enable_fops, &ftrace_event_filter_fops, 961 &ftrace_enable_fops, &ftrace_event_filter_fops,
963 &ftrace_event_format_fops); 962 &ftrace_event_format_fops);
964 if (ret < 0) 963 if (!ret)
965 list_del(&call->list); 964 list_add(&call->list, &ftrace_events);
965
966 return ret; 966 return ret;
967} 967}
968 968
@@ -1124,10 +1124,11 @@ static void trace_module_add_events(struct module *mod)
1124 return; 1124 return;
1125 } 1125 }
1126 call->mod = mod; 1126 call->mod = mod;
1127 list_add(&call->list, &ftrace_events); 1127 ret = event_create_dir(call, d_events,
1128 event_create_dir(call, d_events, 1128 &file_ops->id, &file_ops->enable,
1129 &file_ops->id, &file_ops->enable, 1129 &file_ops->filter, &file_ops->format);
1130 &file_ops->filter, &file_ops->format); 1130 if (!ret)
1131 list_add(&call->list, &ftrace_events);
1131 } 1132 }
1132} 1133}
1133 1134
@@ -1267,10 +1268,12 @@ static __init int event_trace_init(void)
1267 continue; 1268 continue;
1268 } 1269 }
1269 } 1270 }
1270 list_add(&call->list, &ftrace_events); 1271 ret = event_create_dir(call, d_events, &ftrace_event_id_fops,
1271 event_create_dir(call, d_events, &ftrace_event_id_fops, 1272 &ftrace_enable_fops,
1272 &ftrace_enable_fops, &ftrace_event_filter_fops, 1273 &ftrace_event_filter_fops,
1273 &ftrace_event_format_fops); 1274 &ftrace_event_format_fops);
1275 if (!ret)
1276 list_add(&call->list, &ftrace_events);
1274 } 1277 }
1275 1278
1276 while (true) { 1279 while (true) {