Skip to content

Commit 5d79fa0

Browse files
YueHaibingmcgrof
authored andcommitted
ftrace: Fix build warning
If CONFIG_SYSCTL and CONFIG_DYNAMIC_FTRACE is n, build warns: kernel/trace/ftrace.c:7912:13: error: ‘is_permanent_ops_registered’ defined but not used [-Werror=unused-function] static bool is_permanent_ops_registered(void) ^~~~~~~~~~~~~~~~~~~~~~~~~~~ kernel/trace/ftrace.c:89:12: error: ‘last_ftrace_enabled’ defined but not used [-Werror=unused-variable] static int last_ftrace_enabled; ^~~~~~~~~~~~~~~~~~~ Move is_permanent_ops_registered() to ifdef block and mark last_ftrace_enabled as __maybe_unused to fix this. Fixes: 7cde53d ("ftrace: move sysctl_ftrace_enabled to ftrace.c") Signed-off-by: YueHaibing <[email protected]> Acked-by: Steven Rostedt (Google) <[email protected]> Signed-off-by: Luis Chamberlain <[email protected]>
1 parent 3831897 commit 5d79fa0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/trace/ftrace.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ struct ftrace_ops ftrace_list_end __read_mostly = {
8686

8787
/* ftrace_enabled is a method to turn ftrace on or off */
8888
int ftrace_enabled __read_mostly;
89-
static int last_ftrace_enabled;
89+
static int __maybe_unused last_ftrace_enabled;
9090

9191
/* Current function tracing op */
9292
struct ftrace_ops *function_trace_op __read_mostly = &ftrace_list_end;
@@ -7909,6 +7909,7 @@ int unregister_ftrace_function(struct ftrace_ops *ops)
79097909
}
79107910
EXPORT_SYMBOL_GPL(unregister_ftrace_function);
79117911

7912+
#ifdef CONFIG_SYSCTL
79127913
static bool is_permanent_ops_registered(void)
79137914
{
79147915
struct ftrace_ops *op;
@@ -7921,7 +7922,6 @@ static bool is_permanent_ops_registered(void)
79217922
return false;
79227923
}
79237924

7924-
#ifdef CONFIG_SYSCTL
79257925
static int
79267926
ftrace_enable_sysctl(struct ctl_table *table, int write,
79277927
void *buffer, size_t *lenp, loff_t *ppos)

0 commit comments

Comments
 (0)