Skip to content

Commit f115d2b

Browse files
committed
ring-buffer: Remove jump to out label in ring_buffer_swap_cpu()
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 8aabee5 ("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>
1 parent 2d22216 commit f115d2b

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

kernel/trace/ring_buffer.c

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6315,37 +6315,33 @@ int ring_buffer_swap_cpu(struct trace_buffer *buffer_a,
63156315

63166316
if (!cpumask_test_cpu(cpu, buffer_a->cpumask) ||
63176317
!cpumask_test_cpu(cpu, buffer_b->cpumask))
6318-
goto out;
6318+
return -EINVAL;
63196319

63206320
cpu_buffer_a = buffer_a->buffers[cpu];
63216321
cpu_buffer_b = buffer_b->buffers[cpu];
63226322

63236323
/* It's up to the callers to not try to swap mapped buffers */
6324-
if (WARN_ON_ONCE(cpu_buffer_a->mapped || cpu_buffer_b->mapped)) {
6325-
ret = -EBUSY;
6326-
goto out;
6327-
}
6324+
if (WARN_ON_ONCE(cpu_buffer_a->mapped || cpu_buffer_b->mapped))
6325+
return -EBUSY;
63286326

63296327
/* At least make sure the two buffers are somewhat the same */
63306328
if (cpu_buffer_a->nr_pages != cpu_buffer_b->nr_pages)
6331-
goto out;
6329+
return -EINVAL;
63326330

63336331
if (buffer_a->subbuf_order != buffer_b->subbuf_order)
6334-
goto out;
6335-
6336-
ret = -EAGAIN;
6332+
return -EINVAL;
63376333

63386334
if (atomic_read(&buffer_a->record_disabled))
6339-
goto out;
6335+
return -EAGAIN;
63406336

63416337
if (atomic_read(&buffer_b->record_disabled))
6342-
goto out;
6338+
return -EAGAIN;
63436339

63446340
if (atomic_read(&cpu_buffer_a->record_disabled))
6345-
goto out;
6341+
return -EAGAIN;
63466342

63476343
if (atomic_read(&cpu_buffer_b->record_disabled))
6348-
goto out;
6344+
return -EAGAIN;
63496345

63506346
/*
63516347
* We can't do a synchronize_rcu here because this
@@ -6382,7 +6378,6 @@ int ring_buffer_swap_cpu(struct trace_buffer *buffer_a,
63826378
out_dec:
63836379
atomic_dec(&cpu_buffer_a->record_disabled);
63846380
atomic_dec(&cpu_buffer_b->record_disabled);
6385-
out:
63866381
return ret;
63876382
}
63886383
EXPORT_SYMBOL_GPL(ring_buffer_swap_cpu);

0 commit comments

Comments
 (0)