public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>, Ingo Molnar <mingo@redhat.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	"Peter Zijlstra (Intel)" <peterz@infradead.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Tobias Klauser <tklauser@distanz.ch>,
	Wei Yang <richard.weiyang@linux.alibaba.com>,
	Chengming Zhou <zhouchengming@bytedance.com>,
	"Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>,
	"Paul E. McKenney" <paulmck@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] ftrace: shut up -Wcast-function-type warning for ftrace_ops_no_ops
Date: Mon, 22 Mar 2021 22:49:58 +0100	[thread overview]
Message-ID: <20210322215006.1028517-1-arnd@kernel.org> (raw)

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


             reply	other threads:[~2021-03-22 21:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-22 21:49 Arnd Bergmann [this message]
2021-03-22 22:00 ` [PATCH] ftrace: shut up -Wcast-function-type warning for ftrace_ops_no_ops 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210322215006.1028517-1-arnd@kernel.org \
    --to=arnd@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=arnd@arndb.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=naveen.n.rao@linux.vnet.ibm.com \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=richard.weiyang@linux.alibaba.com \
    --cc=rostedt@goodmis.org \
    --cc=tklauser@distanz.ch \
    --cc=zhouchengming@bytedance.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox