Patch "tracing: fix declaration-after-statement warning" has been added to the 5.10-stable tree

gregkh@linuxfoundation.org posted 1 patch 3 weeks, 3 days ago
Failed in applying to current master (apply log)
kernel/trace/trace_events_synth.c |    3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Patch "tracing: fix declaration-after-statement warning" has been added to the 5.10-stable tree
Posted by gregkh@linuxfoundation.org 3 weeks, 3 days ago

This is a note to let you know that I've just added the patch titled

    tracing: fix declaration-after-statement warning

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     tracing-fix-declaration-after-statement-warning.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


From matttbe@kernel.org Sat Oct 18 01:53:59 2025
From: "Matthieu Baerts (NGI0)" <matttbe@kernel.org>
Date: Fri, 17 Oct 2025 18:53:27 +0200
Subject: tracing: fix declaration-after-statement warning
To: stable@vger.kernel.org, Greg Kroah-Hartman <gregkh@linuxfoundation.org>,  Sasha Levin <sashal@kernel.org>
Cc: MPTCP Upstream <mptcp@lists.linux.dev>,  "Matthieu Baerts (NGI0)" <matttbe@kernel.org>,  Douglas Raillard <douglas.raillard@arm.com>,  "Masami Hiramatsu (Google)" <mhiramat@kernel.org>,  "Steven Rostedt (Google)" <rostedt@goodmis.org>,  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Message-ID: <20251017-v5-10-gcc-15-v1-3-cdbbfe1a2100@kernel.org>

From: "Matthieu Baerts (NGI0)" <matttbe@kernel.org>

When building this kernel version this warning is visible:

  kernel/trace/trace_events_synth.c: In function 'synth_event_reg':
  kernel/trace/trace_events_synth.c:847:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    847 |         int ret = trace_event_reg(call, type, data);
        |         ^~~

This can be easily fixed by declaring 'ret' earlier.

This issue is visible in < v5.18, because -std=gnu89 is used by default,
see commit e8c07082a810 ("Kbuild: move to -std=gnu11").

Please note that in v5.15.y, the 'Fixes' commit has been modified during
the backport, not to have this warning. See commit 72848b81b3dd
("tracing: Ensure module defining synth event cannot be unloaded while
tracing") from v5.15.y.

Fixes: 21581dd4e7ff ("tracing: Ensure module defining synth event cannot be unloaded while tracing")
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Cc: Douglas Raillard <douglas.raillard@arm.com>
Cc: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Cc: Steven Rostedt (Google) <rostedt@goodmis.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 kernel/trace/trace_events_synth.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/kernel/trace/trace_events_synth.c
+++ b/kernel/trace/trace_events_synth.c
@@ -831,6 +831,7 @@ static int synth_event_reg(struct trace_
 		    enum trace_reg type, void *data)
 {
 	struct synth_event *event = container_of(call, struct synth_event, call);
+	int ret;
 
 	switch (type) {
 #ifdef CONFIG_PERF_EVENTS
@@ -844,7 +845,7 @@ static int synth_event_reg(struct trace_
 		break;
 	}
 
-	int ret = trace_event_reg(call, type, data);
+	ret = trace_event_reg(call, type, data);
 
 	switch (type) {
 #ifdef CONFIG_PERF_EVENTS


Patches currently in stable-queue which might be from matttbe@kernel.org are

queue-5.10/arch-back-to-std-gnu89-in-v5.18.patch
queue-5.10/x86-boot-compile-boot-code-with-std-gnu11-too.patch
queue-5.10/tracing-fix-declaration-after-statement-warning.patch