ring-buffer: Remove jump to out label in ring_buffer_swap_cpu()

[ Upstream commit f115d2b70b ]

The function ring_buffer_swap_cpu() has a bunch of jumps to the label out
that simply returns "ret". There's no reason to jump to a label that
simply returns a value. Just return directly from there.

This goes back to almost the beginning when commit 8aabee573d
("ring-buffer: remove unneeded get_online_cpus") was introduced. That
commit removed a put_online_cpus() from that label, but never updated all
the jumps to it that now no longer needed to do anything but return a
value.

Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Link: https://lore.kernel.org/20250527145753.6b45d840@gandalf.local.home
Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Stable-dep-of: f27bdc4307 ("ring-buffer: Use current_context for safe per-CPU buffer swap")
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Steven Rostedt
2026-08-23 14:20:07 +02:00
committed by Greg Kroah-Hartman
parent 171f95d662
commit cf0bc75d1c
+6 -9
View File
@@ -5462,28 +5462,26 @@ int ring_buffer_swap_cpu(struct trace_buffer *buffer_a,
if (!cpumask_test_cpu(cpu, buffer_a->cpumask) ||
!cpumask_test_cpu(cpu, buffer_b->cpumask))
goto out;
return -EINVAL;
cpu_buffer_a = buffer_a->buffers[cpu];
cpu_buffer_b = buffer_b->buffers[cpu];
/* At least make sure the two buffers are somewhat the same */
if (cpu_buffer_a->nr_pages != cpu_buffer_b->nr_pages)
goto out;
ret = -EAGAIN;
return -EINVAL;
if (atomic_read(&buffer_a->record_disabled))
goto out;
return -EAGAIN;
if (atomic_read(&buffer_b->record_disabled))
goto out;
return -EAGAIN;
if (atomic_read(&cpu_buffer_a->record_disabled))
goto out;
return -EAGAIN;
if (atomic_read(&cpu_buffer_b->record_disabled))
goto out;
return -EAGAIN;
/*
* We can't do a synchronize_rcu here because this
@@ -5520,7 +5518,6 @@ int ring_buffer_swap_cpu(struct trace_buffer *buffer_a,
out_dec:
atomic_dec(&cpu_buffer_a->record_disabled);
atomic_dec(&cpu_buffer_b->record_disabled);
out:
return ret;
}
EXPORT_SYMBOL_GPL(ring_buffer_swap_cpu);