tracing/urgent: warn in case of ftrace_start_up inbalance
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / kernel / trace / ftrace.c
index bb60732ade0cc7bca54fdbff32a9dfda16bacde9..3718d55fb4c372a826932011ec82e64d9fde40df 100644 (file)
@@ -1224,6 +1224,13 @@ static void ftrace_shutdown(int command)
                return;
 
        ftrace_start_up--;
+       /*
+        * Just warn in case of unbalance, no need to kill ftrace, it's not
+        * critical but the ftrace_call callers may be never nopped again after
+        * further ftrace uses.
+        */
+       WARN_ON_ONCE(ftrace_start_up < 0);
+
        if (!ftrace_start_up)
                command |= FTRACE_DISABLE_CALLS;