linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ftrace: shut up -Wcast-function-type warning for ftrace_ops_no_ops
@ 2021-03-22 21:49 Arnd Bergmann
  2021-03-22 22:00 ` Steven Rostedt
  2021-03-23  7:39 ` Peter Zijlstra
  0 siblings, 2 replies; 6+ messages in thread
From: Arnd Bergmann @ 2021-03-22 21:49 UTC (permalink / raw)
  To: Steven Rostedt, Ingo Molnar
  Cc: Arnd Bergmann, Peter Zijlstra (Intel),
	Adrian Hunter, Tobias Klauser, Wei Yang, Chengming Zhou,
	Naveen N. Rao, Paul E. McKenney, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

With 'make W=1', gcc warns about casts between incompatible function
types:

kernel/trace/ftrace.c:128:31: error: cast between incompatible function types from 'void (*)(long unsigned int,  long unsigned int)' to 'void (*)(long unsigned int,  long unsigned int,  struct ftrace_ops *, struct ftrace_regs *)' [-Werror=cast-function-type]
  128 | #define ftrace_ops_list_func ((ftrace_func_t)ftrace_ops_no_ops)
      |                               ^

As the commet here explains, this one was intentional, so shut up the
warning harder by using a double cast.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 kernel/trace/ftrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 4d8e35575549..d8fc87a17421 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -125,7 +125,7 @@ static void ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip,
 #else
 /* See comment below, where ftrace_ops_list_func is defined */
 static void ftrace_ops_no_ops(unsigned long ip, unsigned long parent_ip);
-#define ftrace_ops_list_func ((ftrace_func_t)ftrace_ops_no_ops)
+#define ftrace_ops_list_func ((ftrace_func_t)(void *)ftrace_ops_no_ops)
 #endif
 
 static inline void ftrace_ops_init(struct ftrace_ops *ops)
-- 
2.29.2


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

end of thread, other threads:[~2021-03-23 16:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-22 21:49 [PATCH] ftrace: shut up -Wcast-function-type warning for ftrace_ops_no_ops Arnd Bergmann
2021-03-22 22:00 ` Steven Rostedt
2021-03-23  7:39 ` Peter Zijlstra
2021-03-23 12:57   ` Steven Rostedt
2021-03-23 15:25     ` Peter Zijlstra
2021-03-23 16:05       ` Peter Zijlstra

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