aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2011-05-23 15:24:25 -0400
committerSteven Rostedt <rostedt@goodmis.org>2011-05-25 22:13:37 -0400
commita1cd6173596c6f7d1f0b41ac7d33ecf03c581edc (patch)
tree413ed775a2c48d8ad003740fa6ef0d912f784842
parent7cbc5b8d4a775a43875a09e29c49a2a8195b5b2d (diff)
ftrace: Have ftrace_startup() return failure code
The register_ftrace_function() returns an error code on failure except if the call to ftrace_startup() fails. Add a error return to ftrace_startup() if it fails to start, allowing register_ftrace_funtion() to return a proper error value. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--kernel/trace/ftrace.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index d017c2c82c44..bebbc959ee8c 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -1638,12 +1638,12 @@ static void ftrace_startup_enable(int command)
1638 ftrace_run_update_code(command); 1638 ftrace_run_update_code(command);
1639} 1639}
1640 1640
1641static void ftrace_startup(struct ftrace_ops *ops, int command) 1641static int ftrace_startup(struct ftrace_ops *ops, int command)
1642{ 1642{
1643 bool hash_enable = true; 1643 bool hash_enable = true;
1644 1644
1645 if (unlikely(ftrace_disabled)) 1645 if (unlikely(ftrace_disabled))
1646 return; 1646 return -ENODEV;
1647 1647
1648 ftrace_start_up++; 1648 ftrace_start_up++;
1649 command |= FTRACE_ENABLE_CALLS; 1649 command |= FTRACE_ENABLE_CALLS;
@@ -1662,6 +1662,8 @@ static void ftrace_startup(struct ftrace_ops *ops, int command)
1662 ftrace_hash_rec_enable(ops, 1); 1662 ftrace_hash_rec_enable(ops, 1);
1663 1663
1664 ftrace_startup_enable(command); 1664 ftrace_startup_enable(command);
1665
1666 return 0;
1665} 1667}
1666 1668
1667static void ftrace_shutdown(struct ftrace_ops *ops, int command) 1669static void ftrace_shutdown(struct ftrace_ops *ops, int command)
@@ -2501,7 +2503,7 @@ static void __enable_ftrace_function_probe(void)
2501 2503
2502 ret = __register_ftrace_function(&trace_probe_ops); 2504 ret = __register_ftrace_function(&trace_probe_ops);
2503 if (!ret) 2505 if (!ret)
2504 ftrace_startup(&trace_probe_ops, 0); 2506 ret = ftrace_startup(&trace_probe_ops, 0);
2505 2507
2506 ftrace_probe_registered = 1; 2508 ftrace_probe_registered = 1;
2507} 2509}
@@ -3466,7 +3468,7 @@ device_initcall(ftrace_nodyn_init);
3466static inline int ftrace_init_dyn_debugfs(struct dentry *d_tracer) { return 0; } 3468static inline int ftrace_init_dyn_debugfs(struct dentry *d_tracer) { return 0; }
3467static inline void ftrace_startup_enable(int command) { } 3469static inline void ftrace_startup_enable(int command) { }
3468/* Keep as macros so we do not need to define the commands */ 3470/* Keep as macros so we do not need to define the commands */
3469# define ftrace_startup(ops, command) do { } while (0) 3471# define ftrace_startup(ops, command) ({0;})
3470# define ftrace_shutdown(ops, command) do { } while (0) 3472# define ftrace_shutdown(ops, command) do { } while (0)
3471# define ftrace_startup_sysctl() do { } while (0) 3473# define ftrace_startup_sysctl() do { } while (0)
3472# define ftrace_shutdown_sysctl() do { } while (0) 3474# define ftrace_shutdown_sysctl() do { } while (0)
@@ -3799,7 +3801,7 @@ int register_ftrace_function(struct ftrace_ops *ops)
3799 3801
3800 ret = __register_ftrace_function(ops); 3802 ret = __register_ftrace_function(ops);
3801 if (!ret) 3803 if (!ret)
3802 ftrace_startup(ops, 0); 3804 ret = ftrace_startup(ops, 0);
3803 3805
3804 3806
3805 out_unlock: 3807 out_unlock:
@@ -4045,7 +4047,7 @@ int register_ftrace_graph(trace_func_graph_ret_t retfunc,
4045 ftrace_graph_return = retfunc; 4047 ftrace_graph_return = retfunc;
4046 ftrace_graph_entry = entryfunc; 4048 ftrace_graph_entry = entryfunc;
4047 4049
4048 ftrace_startup(&global_ops, FTRACE_START_FUNC_RET); 4050 ret = ftrace_startup(&global_ops, FTRACE_START_FUNC_RET);
4049 4051
4050out: 4052out:
4051 mutex_unlock(&ftrace_lock); 4053 mutex_unlock(&ftrace_lock);