diff mbox series

[4/5] ftrace: Use guard to take the ftrace_lock in release_probe()

Message ID 20241028071308.250787901@goodmis.org (mailing list archive)
State Accepted
Commit 9687bbf219549fc93f2364c78aa91fd9ffc9eca0
Headers show
Series ftrace: Use guard to take ftrace_lock | expand

Commit Message

Steven Rostedt Oct. 28, 2024, 7:12 a.m. UTC
From: Steven Rostedt <rostedt@goodmis.org>

The ftrace_lock is held throughout the entire release_probe() function.
Use guard to simplify any exit paths.

Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 kernel/trace/ftrace.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 64997416415e..c0fabd7da5b2 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -5288,7 +5288,7 @@  static void release_probe(struct ftrace_func_probe *probe)
 {
 	struct ftrace_probe_ops *probe_ops;
 
-	mutex_lock(&ftrace_lock);
+	guard(mutex)(&ftrace_lock);
 
 	WARN_ON(probe->ref <= 0);
 
@@ -5306,7 +5306,6 @@  static void release_probe(struct ftrace_func_probe *probe)
 		list_del(&probe->list);
 		kfree(probe);
 	}
-	mutex_unlock(&ftrace_lock);
 }
 
 static void acquire_probe_locked(struct ftrace_func_probe *probe)