Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 88f70d75 authored by Masami Hiramatsu's avatar Masami Hiramatsu Committed by Frederic Weisbecker
Browse files

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: default avatarMasami Hiramatsu <mhiramat@redhat.com>
Acked-by: default avatarSteven Rostedt <rostedt@goodmis.org>
Acked-by: default avatarIngo 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: default avatarFrederic Weisbecker <fweisbec@gmail.com>
parent c0b11d3a
Loading
Loading
Loading
Loading
+14 −11
Original line number Diff line number Diff line
@@ -957,12 +957,12 @@ static int __trace_add_event_call(struct ftrace_event_call *call)
	if (!d_events)
		return -ENOENT;

	list_add(&call->list, &ftrace_events);
	ret = event_create_dir(call, d_events, &ftrace_event_id_fops,
				&ftrace_enable_fops, &ftrace_event_filter_fops,
				&ftrace_event_format_fops);
	if (ret < 0)
		list_del(&call->list);
	if (!ret)
		list_add(&call->list, &ftrace_events);

	return ret;
}

@@ -1124,10 +1124,11 @@ static void trace_module_add_events(struct module *mod)
				return;
		}
		call->mod = mod;
		list_add(&call->list, &ftrace_events);
		event_create_dir(call, d_events,
		ret = event_create_dir(call, d_events,
				       &file_ops->id, &file_ops->enable,
				       &file_ops->filter, &file_ops->format);
		if (!ret)
			list_add(&call->list, &ftrace_events);
	}
}

@@ -1267,10 +1268,12 @@ static __init int event_trace_init(void)
				continue;
			}
		}
		list_add(&call->list, &ftrace_events);
		event_create_dir(call, d_events, &ftrace_event_id_fops,
				 &ftrace_enable_fops, &ftrace_event_filter_fops,
		ret = event_create_dir(call, d_events, &ftrace_event_id_fops,
				       &ftrace_enable_fops,
				       &ftrace_event_filter_fops,
				       &ftrace_event_format_fops);
		if (!ret)
			list_add(&call->list, &ftrace_events);
	}

	while (true) {