]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
tracing: Switch trace_recursion_record.c code over to use guard()
authorYash Suthar <yashsuthar983@gmail.com>
Sat, 2 May 2026 17:47:41 +0000 (23:17 +0530)
committerSteven Rostedt <rostedt@goodmis.org>
Thu, 21 May 2026 22:03:07 +0000 (18:03 -0400)
Switch mutex_lock()/mutex_unlock() to guard().
also drop the ret local variable and return directly.

Link: https://patch.msgid.link/20260502174741.39636-1-yashsuthar983@gmail.com
Signed-off-by: Yash Suthar <yashsuthar983@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
kernel/trace/trace_recursion_record.c

index 784fe1fbb866296f87e8b17455ebbf9025e67233..bac4bc844ccd8bc35c73ad87927b983ae99653a5 100644 (file)
@@ -180,9 +180,8 @@ static const struct seq_operations recursed_function_seq_ops = {
 
 static int recursed_function_open(struct inode *inode, struct file *file)
 {
-       int ret = 0;
+       guard(mutex)(&recursed_function_lock);
 
-       mutex_lock(&recursed_function_lock);
        /* If this file was opened for write, then erase contents */
        if ((file->f_mode & FMODE_WRITE) && (file->f_flags & O_TRUNC)) {
                /* disable updating records */
@@ -194,10 +193,9 @@ static int recursed_function_open(struct inode *inode, struct file *file)
                atomic_set(&nr_records, 0);
        }
        if (file->f_mode & FMODE_READ)
-               ret = seq_open(file, &recursed_function_seq_ops);
-       mutex_unlock(&recursed_function_lock);
+               return seq_open(file, &recursed_function_seq_ops);
 
-       return ret;
+       return 0;
 }
 
 static ssize_t recursed_function_write(struct file *file,