* [PATCH] tracing/eprobe: drop unneeded breaks
@ 2023-09-28 10:43 Julia Lawall
2023-09-29 11:32 ` Masami Hiramatsu
0 siblings, 1 reply; 5+ messages in thread
From: Julia Lawall @ 2023-09-28 10:43 UTC (permalink / raw)
To: Steven Rostedt
Cc: kernel-janitors, Masami Hiramatsu, linux-kernel,
linux-trace-kernel
Drop break after return.
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;
}
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] tracing/eprobe: drop unneeded breaks
2023-09-28 10:43 [PATCH] tracing/eprobe: drop unneeded breaks Julia Lawall
@ 2023-09-29 11:32 ` Masami Hiramatsu
2023-09-29 11:37 ` Julia Lawall
0 siblings, 1 reply; 5+ messages in thread
From: Masami Hiramatsu @ 2023-09-29 11:32 UTC (permalink / raw)
To: Julia Lawall
Cc: Steven Rostedt, kernel-janitors, Masami Hiramatsu, linux-kernel,
linux-trace-kernel
On Thu, 28 Sep 2023 12:43:34 +0200
Julia Lawall <Julia.Lawall@inria.fr> wrote:
> 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")
> 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) <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] tracing/eprobe: drop unneeded breaks
2023-09-29 11:32 ` Masami Hiramatsu
@ 2023-09-29 11:37 ` Julia Lawall
2023-09-30 9:19 ` Masami Hiramatsu
0 siblings, 1 reply; 5+ messages in thread
From: Julia Lawall @ 2023-09-29 11:37 UTC (permalink / raw)
To: Masami Hiramatsu
Cc: Steven Rostedt, kernel-janitors, linux-kernel, linux-trace-kernel
On Fri, 29 Sep 2023, Masami Hiramatsu wrote:
> On Thu, 28 Sep 2023 12:43:34 +0200
> Julia Lawall <Julia.Lawall@inria.fr> wrote:
>
> > 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.
julia
>
> > 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) <mhiramat@kernel.org>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] tracing/eprobe: drop unneeded breaks
2023-09-29 11:37 ` Julia Lawall
@ 2023-09-30 9:19 ` Masami Hiramatsu
2023-10-12 10:40 ` Dan Carpenter
0 siblings, 1 reply; 5+ messages in thread
From: Masami Hiramatsu @ 2023-09-30 9:19 UTC (permalink / raw)
To: Julia Lawall
Cc: Steven Rostedt, kernel-janitors, linux-kernel, linux-trace-kernel
On Fri, 29 Sep 2023 13:37:08 +0200 (CEST)
Julia Lawall <julia.lawall@inria.fr> wrote:
>
>
> On Fri, 29 Sep 2023, Masami Hiramatsu wrote:
>
> > On Thu, 28 Sep 2023 12:43:34 +0200
> > Julia Lawall <Julia.Lawall@inria.fr> wrote:
> >
> > > 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
>
> >
> > > 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) <mhiramat@kernel.org>
> >
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] tracing/eprobe: drop unneeded breaks
2023-09-30 9:19 ` Masami Hiramatsu
@ 2023-10-12 10:40 ` Dan Carpenter
0 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2023-10-12 10:40 UTC (permalink / raw)
To: Masami Hiramatsu
Cc: Julia Lawall, Steven Rostedt, kernel-janitors, linux-kernel,
linux-trace-kernel
On Sat, Sep 30, 2023 at 06:19:02PM +0900, Masami Hiramatsu wrote:
> On Fri, 29 Sep 2023 13:37:08 +0200 (CEST)
> Julia Lawall <julia.lawall@inria.fr> wrote:
>
> >
> >
> > On Fri, 29 Sep 2023, Masami Hiramatsu wrote:
> >
> > > On Thu, 28 Sep 2023 12:43:34 +0200
> > > Julia Lawall <Julia.Lawall@inria.fr> wrote:
> > >
> > > > 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.)
I don't think GCC warns about unreachable code, but yeah, in Smatch
unreachable break statements do not trigger a warning. People like
to add extra break statements to switch statements.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-10-12 10:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-28 10:43 [PATCH] tracing/eprobe: drop unneeded breaks Julia Lawall
2023-09-29 11:32 ` Masami Hiramatsu
2023-09-29 11:37 ` Julia Lawall
2023-09-30 9:19 ` Masami Hiramatsu
2023-10-12 10:40 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).