diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index e295c413580ed0a8c4b5a0e7633c9054db87b0f7..eccb4e1187cc788e2f4f60b15bd7b4c00bd2884b 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -1929,6 +1929,12 @@ static int run_tracer_selftest(struct tracer *type) if (!selftests_can_run) return save_selftest(type); + if (!tracing_is_on()) { + pr_warn("Selftest for tracer %s skipped due to tracing disabled\n", + type->name); + return 0; + } + /* * Run a selftest on this tracer. * Here we reset the trace buffer, and set the current