linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] ftrace: Fix build warning
@ 2022-04-07  7:46 YueHaibing
  2022-04-07 14:59 ` Steven Rostedt
  0 siblings, 1 reply; 3+ messages in thread
From: YueHaibing @ 2022-04-07  7:46 UTC (permalink / raw)
  To: rostedt, mingo, mcgrof, xiaowei66; +Cc: linux-kernel, YueHaibing

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: 7cde53da38a3 ("ftrace: move sysctl_ftrace_enabled to ftrace.c")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 kernel/trace/ftrace.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index a5efbbc289b4..db8d553728b6 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -86,7 +86,7 @@ struct ftrace_ops ftrace_list_end __read_mostly = {
 
 /* ftrace_enabled is a method to turn ftrace on or off */
 int ftrace_enabled __read_mostly;
-static int last_ftrace_enabled;
+static int __maybe_unused last_ftrace_enabled;
 
 /* Current function tracing op */
 struct ftrace_ops *function_trace_op __read_mostly = &ftrace_list_end;
@@ -7909,6 +7909,7 @@ int unregister_ftrace_function(struct ftrace_ops *ops)
 }
 EXPORT_SYMBOL_GPL(unregister_ftrace_function);
 
+#ifdef CONFIG_SYSCTL
 static bool is_permanent_ops_registered(void)
 {
 	struct ftrace_ops *op;
@@ -7921,7 +7922,6 @@ static bool is_permanent_ops_registered(void)
 	return false;
 }
 
-#ifdef CONFIG_SYSCTL
 static int
 ftrace_enable_sysctl(struct ctl_table *table, int write,
 		     void *buffer, size_t *lenp, loff_t *ppos)
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] ftrace: Fix build warning
  2022-04-07  7:46 [PATCH -next] ftrace: Fix build warning YueHaibing
@ 2022-04-07 14:59 ` Steven Rostedt
  2022-04-15 21:57   ` Luis Chamberlain
  0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2022-04-07 14:59 UTC (permalink / raw)
  To: YueHaibing; +Cc: mingo, mcgrof, xiaowei66, linux-kernel

On Thu, 7 Apr 2022 15:46:12 +0800
YueHaibing <yuehaibing@huawei.com> wrote:

> 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: 7cde53da38a3 ("ftrace: move sysctl_ftrace_enabled to ftrace.c")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
>  kernel/trace/ftrace.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org>

-- Steve

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] ftrace: Fix build warning
  2022-04-07 14:59 ` Steven Rostedt
@ 2022-04-15 21:57   ` Luis Chamberlain
  0 siblings, 0 replies; 3+ messages in thread
From: Luis Chamberlain @ 2022-04-15 21:57 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: YueHaibing, mingo, xiaowei66, linux-kernel

On Thu, Apr 07, 2022 at 10:59:17AM -0400, Steven Rostedt wrote:
> On Thu, 7 Apr 2022 15:46:12 +0800
> YueHaibing <yuehaibing@huawei.com> wrote:
> 
> > 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: 7cde53da38a3 ("ftrace: move sysctl_ftrace_enabled to ftrace.c")
> > Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> > ---
> >  kernel/trace/ftrace.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org>

Queued onto sysctl-testing. I have one more fix I just posted for this too.

  Luis

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-15 21:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-07  7:46 [PATCH -next] ftrace: Fix build warning YueHaibing
2022-04-07 14:59 ` Steven Rostedt
2022-04-15 21:57   ` Luis Chamberlain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).