mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 06:04:44 +01:00
tracing/uprobe: Adopt guard() and scoped_guard()
Use guard() or scoped_guard() in uprobe events for critical sections rather than discrete lock/unlock pairs. Link: https://lore.kernel.org/all/173289889911.73724.12457932738419630525.stgit@devnote2/ Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
This commit is contained in:
parent
2cba0070cd
commit
f8821732dc
1 changed files with 5 additions and 10 deletions
|
|
@ -498,11 +498,11 @@ static int register_trace_uprobe(struct trace_uprobe *tu)
|
|||
struct trace_uprobe *old_tu;
|
||||
int ret;
|
||||
|
||||
mutex_lock(&event_mutex);
|
||||
guard(mutex)(&event_mutex);
|
||||
|
||||
ret = validate_ref_ctr_offset(tu);
|
||||
if (ret)
|
||||
goto end;
|
||||
return ret;
|
||||
|
||||
/* register as an event */
|
||||
old_tu = find_probe_event(trace_probe_name(&tu->tp),
|
||||
|
|
@ -511,11 +511,9 @@ static int register_trace_uprobe(struct trace_uprobe *tu)
|
|||
if (is_ret_probe(tu) != is_ret_probe(old_tu)) {
|
||||
trace_probe_log_set_index(0);
|
||||
trace_probe_log_err(0, DIFF_PROBE_TYPE);
|
||||
ret = -EEXIST;
|
||||
} else {
|
||||
ret = append_trace_uprobe(tu, old_tu);
|
||||
return -EEXIST;
|
||||
}
|
||||
goto end;
|
||||
return append_trace_uprobe(tu, old_tu);
|
||||
}
|
||||
|
||||
ret = register_uprobe_event(tu);
|
||||
|
|
@ -525,14 +523,11 @@ static int register_trace_uprobe(struct trace_uprobe *tu)
|
|||
trace_probe_log_err(0, EVENT_EXIST);
|
||||
} else
|
||||
pr_warn("Failed to register probe event(%d)\n", ret);
|
||||
goto end;
|
||||
return ret;
|
||||
}
|
||||
|
||||
dyn_event_add(&tu->devent, trace_probe_event_call(&tu->tp));
|
||||
|
||||
end:
|
||||
mutex_unlock(&event_mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue