History

tracing: Return error if register_ftrace_function_probe() fails for event_enable_func()

register_ftrace_function_probe() returns the number of functions it registered, which can be zero, it can also return a negative number if something went wrong. But event_enable_func() only checks for the case that it didn't register anything, it needs to also check for the case that something went wrong and return that error code as well. Added some comments about the code as well, to make it more understandable.

Steven Rostedt (Red Hat) committed 13 years ago

Commit ff305de1 parent a5b85bd1 file · +9 −2Browse files

Showing the changes to kernel/trace (1 of 1 file). Show all

Unified · Split

kernel/trace/trace_events.c+9−2
@@ -2061,11 +2061,18 @@ event_enable_func(struct ftrace_hash *hash, · 2060 unmodified lines
2061 if (ret < 0)2061 if (ret < 0)
2062 goto out_put;2062 goto out_put;
2063 ret = register_ftrace_function_probe(glob, ops, data);2063 ret = register_ftrace_function_probe(glob, ops, data);
2064 /*
2065 * The above returns on success the # of functions enabled,
2066 * but if it didn't find any functions it returns zero.
2067 * Consider no functions a failure too.
2068 */
2064 if (!ret) {2069 if (!ret) {
2065 ret = -ENOENT;2070 ret = -ENOENT;
2066 goto out_disable;2071 goto out_disable;
2067 } else2072 } else if (ret < 0)
2068 ret = 0;2073 goto out_disable;
2074 /* Just return zero, not the number of enabled functions */
2075 ret = 0;
2069 out:2076 out:
2070 mutex_unlock(&event_mutex);2077 mutex_unlock(&event_mutex);
2071 return ret;2078 return ret;