Skip to content

Commit 1b94b3a

Browse files
Tom Zanussirostedt
authored andcommitted
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.org Suggested-by: Masami Hiramatsu <[email protected]> Signed-off-by: Tom Zanussi <[email protected]> Signed-off-by: Steven Rostedt (VMware) <[email protected]>
1 parent fc9d276 commit 1b94b3a

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

kernel/trace/trace_events_hist.c

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1845,7 +1845,6 @@ __synth_event_trace_start(struct trace_event_file *file,
18451845
if (!(file->flags & EVENT_FILE_FL_ENABLED) ||
18461846
trace_trigger_soft_disabled(file)) {
18471847
trace_state->disabled = true;
1848-
ret = -ENOENT;
18491848
goto out;
18501849
}
18511850

@@ -1907,11 +1906,8 @@ int synth_event_trace(struct trace_event_file *file, unsigned int n_vals, ...)
19071906
int ret;
19081907

19091908
ret = __synth_event_trace_start(file, &state);
1910-
if (ret) {
1911-
if (ret == -ENOENT)
1912-
ret = 0; /* just disabled, not really an error */
1909+
if (ret || state.disabled)
19131910
return ret;
1914-
}
19151911

19161912
if (n_vals != state.event->n_fields) {
19171913
ret = -EINVAL;
@@ -1987,11 +1983,8 @@ int synth_event_trace_array(struct trace_event_file *file, u64 *vals,
19871983
int ret;
19881984

19891985
ret = __synth_event_trace_start(file, &state);
1990-
if (ret) {
1991-
if (ret == -ENOENT)
1992-
ret = 0; /* just disabled, not really an error */
1986+
if (ret || state.disabled)
19931987
return ret;
1994-
}
19951988

19961989
if (n_vals != state.event->n_fields) {
19971990
ret = -EINVAL;
@@ -2067,16 +2060,10 @@ EXPORT_SYMBOL_GPL(synth_event_trace_array);
20672060
int synth_event_trace_start(struct trace_event_file *file,
20682061
struct synth_event_trace_state *trace_state)
20692062
{
2070-
int ret;
2071-
20722063
if (!trace_state)
20732064
return -EINVAL;
20742065

2075-
ret = __synth_event_trace_start(file, trace_state);
2076-
if (ret == -ENOENT)
2077-
ret = 0; /* just disabled, not really an error */
2078-
2079-
return ret;
2066+
return __synth_event_trace_start(file, trace_state);
20802067
}
20812068
EXPORT_SYMBOL_GPL(synth_event_trace_start);
20822069

0 commit comments

Comments
 (0)