]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
tracing: Switch trace_events_hist.c code over to use guard()
authorSteven Rostedt <rostedt@goodmis.org>
Thu, 19 Dec 2024 20:12:05 +0000 (15:12 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Apr 2025 12:37:41 +0000 (14:37 +0200)
commit77b7dbd3420e82292cb08d85dc102d2c76071584
treeb182329b0c25eca3b48826a9c0fb1ccc957ebfc3
parentf568fbe8c603bca656dcf5e4c92ea407684fec55
tracing: Switch trace_events_hist.c code over to use guard()

[ Upstream commit 2b36a97aeeb71b1e4a48bfedc7f21f44aeb1e6fb ]

There are a couple functions in trace_events_hist.c that have "goto out" or
equivalent on error in order to release locks that were taken. This can be
error prone or just simply make the code more complex.

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

Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/20241219201345.694601480@goodmis.org
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Stable-dep-of: 0b4ffbe4888a ("tracing: Correct the refcount if the hist/hist_debug file fails to open")
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/trace/trace_events_hist.c