Thread (5 messages) 5 messages, 3 authors, 2023-10-12

Re: [PATCH] tracing/eprobe: drop unneeded breaks

From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Date: 2023-09-30 09:19:10
Also in: kernel-janitors, lkml

On Fri, 29 Sep 2023 13:37:08 +0200 (CEST)
Julia Lawall [off-list ref] wrote:

On Fri, 29 Sep 2023, Masami Hiramatsu  wrote:
quoted
On Thu, 28 Sep 2023 12:43:34 +0200
Julia Lawall [off-list ref] wrote:
quoted
Drop break after return.
Good catch! This looks good to me.

Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>

And

Fixes: 7491e2c44278 ("tracing: Add a probe that attaches to trace events")
Thanks.  I didn't include that because it's not a bug.  But it does break
Coccinelle, which is how I noticed it.
OK, I got it. I thought it may cause a compiler warning because the
'break' never be executed. (maybe it is just a flow-control word,
so it may not need to be warned, but a bit storange.)
julia
quoted
quoted
Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>

---
 kernel/trace/trace_eprobe.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/kernel/trace/trace_eprobe.c b/kernel/trace/trace_eprobe.c
index 72714cbf475c..03c851f57969 100644
--- a/kernel/trace/trace_eprobe.c
+++ b/kernel/trace/trace_eprobe.c
@@ -788,12 +788,9 @@ find_and_get_event(const char *system, const char *event_name)
 		name = trace_event_name(tp_event);
 		if (!name || strcmp(event_name, name))
 			continue;
-		if (!trace_event_try_get_ref(tp_event)) {
+		if (!trace_event_try_get_ref(tp_event))
 			return NULL;
-			break;
-		}
 		return tp_event;
-		break;
 	}
 	return NULL;
 }

--
Masami Hiramatsu (Google) [off-list ref]

-- 
Masami Hiramatsu (Google) [off-list ref]
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help