Commit 1b94b3ae authored by Tom Zanussi's avatar Tom Zanussi Committed by Steven Rostedt (VMware)

tracing: Check state.disabled in synth event trace functions

Since trace_state.disabled is set in __synth_event_trace_start() at
the same time -ENOENT is returned, don't bother returning -ENOENT -
just have callers check trace_state.disabled instead, and avoid the
extra return val munging.

Link: http://lkml.kernel.org/r/87315c3889af870e8370e82b76cf48b426d70130.1585941485.git.zanussi@kernel.orgSuggested-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: default avatarTom Zanussi <zanussi@kernel.org>
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@godmis.org>
parent fc9d276f
...@@ -1845,7 +1845,6 @@ __synth_event_trace_start(struct trace_event_file *file, ...@@ -1845,7 +1845,6 @@ __synth_event_trace_start(struct trace_event_file *file,
if (!(file->flags & EVENT_FILE_FL_ENABLED) || if (!(file->flags & EVENT_FILE_FL_ENABLED) ||
trace_trigger_soft_disabled(file)) { trace_trigger_soft_disabled(file)) {
trace_state->disabled = true; trace_state->disabled = true;
ret = -ENOENT;
goto out; goto out;
} }
...@@ -1907,11 +1906,8 @@ int synth_event_trace(struct trace_event_file *file, unsigned int n_vals, ...) ...@@ -1907,11 +1906,8 @@ int synth_event_trace(struct trace_event_file *file, unsigned int n_vals, ...)
int ret; int ret;
ret = __synth_event_trace_start(file, &state); ret = __synth_event_trace_start(file, &state);
if (ret) { if (ret || state.disabled)
if (ret == -ENOENT)
ret = 0; /* just disabled, not really an error */
return ret; return ret;
}
if (n_vals != state.event->n_fields) { if (n_vals != state.event->n_fields) {
ret = -EINVAL; ret = -EINVAL;
...@@ -1987,11 +1983,8 @@ int synth_event_trace_array(struct trace_event_file *file, u64 *vals, ...@@ -1987,11 +1983,8 @@ int synth_event_trace_array(struct trace_event_file *file, u64 *vals,
int ret; int ret;
ret = __synth_event_trace_start(file, &state); ret = __synth_event_trace_start(file, &state);
if (ret) { if (ret || state.disabled)
if (ret == -ENOENT)
ret = 0; /* just disabled, not really an error */
return ret; return ret;
}
if (n_vals != state.event->n_fields) { if (n_vals != state.event->n_fields) {
ret = -EINVAL; ret = -EINVAL;
...@@ -2067,16 +2060,10 @@ EXPORT_SYMBOL_GPL(synth_event_trace_array); ...@@ -2067,16 +2060,10 @@ EXPORT_SYMBOL_GPL(synth_event_trace_array);
int synth_event_trace_start(struct trace_event_file *file, int synth_event_trace_start(struct trace_event_file *file,
struct synth_event_trace_state *trace_state) struct synth_event_trace_state *trace_state)
{ {
int ret;
if (!trace_state) if (!trace_state)
return -EINVAL; return -EINVAL;
ret = __synth_event_trace_start(file, trace_state); return __synth_event_trace_start(file, trace_state);
if (ret == -ENOENT)
ret = 0; /* just disabled, not really an error */
return ret;
} }
EXPORT_SYMBOL_GPL(synth_event_trace_start); EXPORT_SYMBOL_GPL(synth_event_trace_start);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment