Skip to content

Commit

Permalink
tracing: Use IS_ERR() check for return value of tracing_init_dentry()
Browse files Browse the repository at this point in the history
tracing_init_dentry() will soon return NULL as a valid pointer for the
top level tracing directroy. NULL can not be used as an error value.
Instead, switch to ERR_PTR() and check the return status with
IS_ERR().

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
  • Loading branch information
Steven Rostedt (Red Hat) committed Jan 22, 2015
1 parent 3efb5f2 commit 14a5ae4
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion kernel/trace/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -5419,7 +5419,7 @@ static __init int ftrace_init_debugfs(void)
struct dentry *d_tracer;

d_tracer = tracing_init_dentry();
if (!d_tracer)
if (IS_ERR(d_tracer))
return 0;

ftrace_init_dyn_debugfs(d_tracer);
Expand Down
8 changes: 4 additions & 4 deletions kernel/trace/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -5820,7 +5820,7 @@ struct dentry *tracing_init_dentry_tr(struct trace_array *tr)
return tr->dir;

if (!debugfs_initialized())
return NULL;
return ERR_PTR(-ENODEV);

if (tr->flags & TRACE_ARRAY_FL_GLOBAL)
tr->dir = debugfs_create_dir("tracing", NULL);
Expand All @@ -5844,7 +5844,7 @@ static struct dentry *tracing_dentry_percpu(struct trace_array *tr, int cpu)
return tr->percpu_dir;

d_tracer = tracing_init_dentry_tr(tr);
if (!d_tracer)
if (IS_ERR(d_tracer))
return NULL;

tr->percpu_dir = debugfs_create_dir("per_cpu", d_tracer);
Expand Down Expand Up @@ -6047,7 +6047,7 @@ static struct dentry *trace_options_init_dentry(struct trace_array *tr)
return tr->options;

d_tracer = tracing_init_dentry_tr(tr);
if (!d_tracer)
if (IS_ERR(d_tracer))
return NULL;

tr->options = debugfs_create_dir("options", d_tracer);
Expand Down Expand Up @@ -6538,7 +6538,7 @@ static __init int tracer_init_debugfs(void)
trace_access_lock_init();

d_tracer = tracing_init_dentry();
if (!d_tracer)
if (IS_ERR(d_tracer))
return 0;

init_tracer_debugfs(&global_trace, d_tracer);
Expand Down
2 changes: 1 addition & 1 deletion kernel/trace/trace_events.c
Original file line number Diff line number Diff line change
Expand Up @@ -2490,7 +2490,7 @@ static __init int event_trace_init(void)
return -ENODEV;

d_tracer = tracing_init_dentry();
if (!d_tracer)
if (IS_ERR(d_tracer))
return 0;

entry = debugfs_create_file("available_events", 0444, d_tracer,
Expand Down
2 changes: 1 addition & 1 deletion kernel/trace/trace_functions_graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -1437,7 +1437,7 @@ static __init int init_graph_debugfs(void)
struct dentry *d_tracer;

d_tracer = tracing_init_dentry();
if (!d_tracer)
if (IS_ERR(d_tracer))
return 0;

trace_create_file("max_graph_depth", 0644, d_tracer,
Expand Down
2 changes: 1 addition & 1 deletion kernel/trace/trace_kprobe.c
Original file line number Diff line number Diff line change
Expand Up @@ -1320,7 +1320,7 @@ static __init int init_kprobe_trace(void)
return -EINVAL;

d_tracer = tracing_init_dentry();
if (!d_tracer)
if (IS_ERR(d_tracer))
return 0;

entry = debugfs_create_file("kprobe_events", 0644, d_tracer,
Expand Down
2 changes: 1 addition & 1 deletion kernel/trace/trace_printk.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ static __init int init_trace_printk_function_export(void)
struct dentry *d_tracer;

d_tracer = tracing_init_dentry();
if (!d_tracer)
if (IS_ERR(d_tracer))
return 0;

trace_create_file("printk_formats", 0444, d_tracer,
Expand Down
2 changes: 1 addition & 1 deletion kernel/trace/trace_stack.c
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ static __init int stack_trace_init(void)
struct dentry *d_tracer;

d_tracer = tracing_init_dentry();
if (!d_tracer)
if (IS_ERR(d_tracer))
return 0;

trace_create_file("stack_max_size", 0644, d_tracer,
Expand Down
2 changes: 1 addition & 1 deletion kernel/trace/trace_stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ static int tracing_stat_init(void)
struct dentry *d_tracing;

d_tracing = tracing_init_dentry();
if (!d_tracing)
if (IS_ERR(d_tracing))
return 0;

stat_dir = debugfs_create_dir("trace_stat", d_tracing);
Expand Down
2 changes: 1 addition & 1 deletion kernel/trace/trace_uprobe.c
Original file line number Diff line number Diff line change
Expand Up @@ -1321,7 +1321,7 @@ static __init int init_uprobe_trace(void)
struct dentry *d_tracer;

d_tracer = tracing_init_dentry();
if (!d_tracer)
if (IS_ERR(d_tracer))
return 0;

trace_create_file("uprobe_events", 0644, d_tracer,
Expand Down

0 comments on commit 14a5ae4

Please sign in to comment.