function-graph: allow unregistering twice
[deliverable/linux.git] / kernel / trace / ftrace.c
index 1752a63f37c02d535b961a68efa20313cb147faf..f1ed080406c31f6bf61025e34e626f71b2865ad6 100644 (file)
@@ -2719,6 +2719,9 @@ void unregister_ftrace_graph(void)
 {
        mutex_lock(&ftrace_lock);
 
+       if (!unlikely(atomic_read(&ftrace_graph_active)))
+               goto out;
+
        atomic_dec(&ftrace_graph_active);
        unregister_trace_sched_switch(ftrace_graph_probe_sched_switch);
        ftrace_graph_return = (trace_func_graph_ret_t)ftrace_stub;
@@ -2726,6 +2729,7 @@ void unregister_ftrace_graph(void)
        ftrace_shutdown(FTRACE_STOP_FUNC_RET);
        unregister_pm_notifier(&ftrace_suspend_notifier);
 
+ out:
        mutex_unlock(&ftrace_lock);
 }
 
This page took 0.029614 seconds and 5 git commands to generate.