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