]> www.infradead.org Git - users/jedix/linux-maple.git/commit
ring-buffer: Simplify ring_buffer_read_page() with guard()
authorSteven Rostedt <rostedt@goodmis.org>
Tue, 27 May 2025 18:52:16 +0000 (14:52 -0400)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Thu, 29 May 2025 12:24:07 +0000 (08:24 -0400)
commitb2e7c6ed26e90fab1e5e626071e54e3b9ec9cb5a
treec5ce241908622a1e2ede69d3e0db55605d5f9f95
parentf0d8cbc8ccc6299046ceb5023a2af9e2b75c4106
ring-buffer: Simplify ring_buffer_read_page() with guard()

The function ring_buffer_read_page() had two gotos. One was simply
returning "ret" and the other was unlocking the reader_lock.

There's no reason to use goto to simply return the "ret" variable. Instead
just return the value.

The jump to the unlocking of the reader_lock can be replaced by
guard(raw_spinlock_irqsave)(&cpu_buffer->reader_lock).

With these two changes the "ret" variable is no longer used and can be
removed. The return value on non-error is what was read and is stored in
the "read" variable.

Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Link: https://lore.kernel.org/20250527145216.0187cf36@gandalf.local.home
Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
kernel/trace/ring_buffer.c