linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ftrace: avoid unused-variable warning
@ 2017-07-10 11:04 Arnd Bergmann
  2017-07-11 22:58 ` Steven Rostedt
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2017-07-10 11:04 UTC (permalink / raw)
  To: Steven Rostedt, Ingo Molnar; +Cc: Arnd Bergmann, linux-kernel

When CONFIG_DYNAMIC_FTRACE is disabled, we get a harmless
compile-time warning:

kernel/trace/trace_stack.c: In function 'stack_trace_filter_open':
kernel/trace/trace_stack.c:412:21: error: unused variable 'ops' [-Werror=unused-variable]

We could replace the macros in linux/ftrace.h with inline functions,
which would solve this problem for all callers. However, as these
are only called internally in the ftrace code, it seems simpler
to change the caller instead.

Fixes: 0f17976568b3 ("ftrace: Fix regression with module command in stack_trace_filter")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 kernel/trace/trace_stack.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c
index b4a751e8f9d6..0ff29008383b 100644
--- a/kernel/trace/trace_stack.c
+++ b/kernel/trace/trace_stack.c
@@ -409,9 +409,7 @@ static const struct file_operations stack_trace_fops = {
 static int
 stack_trace_filter_open(struct inode *inode, struct file *file)
 {
-	struct ftrace_ops *ops = inode->i_private;
-
-	return ftrace_regex_open(ops, FTRACE_ITER_FILTER,
+	return ftrace_regex_open(inode->i_private, FTRACE_ITER_FILTER,
 				 inode, file);
 }
 
-- 
2.9.0

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

* Re: [PATCH] ftrace: avoid unused-variable warning
  2017-07-10 11:04 [PATCH] ftrace: avoid unused-variable warning Arnd Bergmann
@ 2017-07-11 22:58 ` Steven Rostedt
  0 siblings, 0 replies; 2+ messages in thread
From: Steven Rostedt @ 2017-07-11 22:58 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Ingo Molnar, linux-kernel

On Mon, 10 Jul 2017 13:04:56 +0200
Arnd Bergmann <arnd@arndb.de> wrote:

> When CONFIG_DYNAMIC_FTRACE is disabled, we get a harmless
> compile-time warning:
> 
> kernel/trace/trace_stack.c: In function 'stack_trace_filter_open':
> kernel/trace/trace_stack.c:412:21: error: unused variable 'ops' [-Werror=unused-variable]
> 
> We could replace the macros in linux/ftrace.h with inline functions,
> which would solve this problem for all callers. However, as these
> are only called internally in the ftrace code, it seems simpler
> to change the caller instead.

Actually we can't replace them, as they are called when ftrace is not
defined, and the ops isn't defined either (which the comment above the
macros state).

> 
> Fixes: 0f17976568b3 ("ftrace: Fix regression with module command in stack_trace_filter")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  kernel/trace/trace_stack.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c
> index b4a751e8f9d6..0ff29008383b 100644
> --- a/kernel/trace/trace_stack.c
> +++ b/kernel/trace/trace_stack.c
> @@ -409,9 +409,7 @@ static const struct file_operations stack_trace_fops = {
>  static int
>  stack_trace_filter_open(struct inode *inode, struct file *file)
>  {
> -	struct ftrace_ops *ops = inode->i_private;
> -
> -	return ftrace_regex_open(ops, FTRACE_ITER_FILTER,
> +	return ftrace_regex_open(inode->i_private, FTRACE_ITER_FILTER,

Actually, I'm glad you mentioned this warning. Because this file should
not be exposed if DYNAMIC_FTRACE is not set.

I'll fix.

Thanks!

-- Steve

>  				 inode, file);
>  }
>  

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

end of thread, other threads:[~2017-07-11 22:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-10 11:04 [PATCH] ftrace: avoid unused-variable warning Arnd Bergmann
2017-07-11 22:58 ` Steven Rostedt

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).