diff options
| author | Yash Suthar <yashsuthar983@gmail.com> | 2026-05-02 20:47:41 +0300 |
|---|---|---|
| committer | Steven Rostedt <rostedt@goodmis.org> | 2026-05-22 01:03:07 +0300 |
| commit | 8a6e9af2fac8cf212f86cff282ae96f6c7d7ca18 (patch) | |
| tree | cf9d75e7471ffdc7a4be50b46599a4cf88ae9a29 | |
| parent | 04fcbcf2dfe6a3fadc50b0f925c0b757386b82f8 (diff) | |
| download | linux-8a6e9af2fac8cf212f86cff282ae96f6c7d7ca18.tar.xz | |
tracing: Switch trace_recursion_record.c code over to use guard()
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>
| -rw-r--r-- | kernel/trace/trace_recursion_record.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/kernel/trace/trace_recursion_record.c b/kernel/trace/trace_recursion_record.c index 784fe1fbb866..bac4bc844ccd 100644 --- a/kernel/trace/trace_recursion_record.c +++ b/kernel/trace/trace_recursion_record.c @@ -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, |
