]> www.infradead.org Git - users/dwmw2/linux.git/commit
tracing: Switch trace.c code over to use guard()
authorSteven Rostedt <rostedt@goodmis.org>
Wed, 25 Dec 2024 03:14:13 +0000 (22:14 -0500)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Thu, 26 Dec 2024 15:38:17 +0000 (10:38 -0500)
commitd33b10c0c73adca00f72bf4a153a07b7f5f34715
tree453275413c01ea68e669609bf8f81bfc038eee05
parent4bbf9020becbfd8fc2c3da790855b7042fad455b
tracing: Switch trace.c code over to use guard()

There are several functions in trace.c that have "goto out;" or
equivalent on error in order to release locks or free values that were
allocated. This can be error prone or just simply make the code more
complex.

Switch every location that ends with unlocking a mutex or freeing on error
over to using the guard(mutex)() and __free() infrastructure to let the
compiler worry about releasing locks. This makes the code easier to read
and understand.

There's one place that should probably return an error but instead return
0. This does not change the return as the only changes are to do the
conversion without changing the logic. Fixing that location will have to
come later.

Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Link: https://lore.kernel.org/20241224221413.7b8c68c3@batman.local.home
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
kernel/trace/trace.c