Message ID | 20230928104334.41215-1-Julia.Lawall@inria.fr |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp3244453vqu; Thu, 28 Sep 2023 04:40:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFl8LSTSBZD1E/bL2yeX4JKhSxMevrn120963/+dtc0g3BRSeE35HrRrVD6ErdYWvAEXJVf X-Received: by 2002:a9d:624a:0:b0:6be:e447:da3 with SMTP id i10-20020a9d624a000000b006bee4470da3mr938995otk.28.1695901240499; Thu, 28 Sep 2023 04:40:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695901240; cv=none; d=google.com; s=arc-20160816; b=sW1qmjvqOoWIz3aC+MComrK8+kS3dqCgYqzQpcBcxH3l2XrW421gshW89yIYsn2X4a wawUvpG8STFmlMA0Y/bYKXmuzRIzbcmYtWuGvGPU6r7gxIJ0S9sdYAxiHVCsXWYj3ejh sHvQVNYa+6enP6+mKUlaPTpI3dVQQf1vLC2KjoKOipDgm8uuaokQ2NiXd/6CnGn9Ad8P mODlxHY8ThY7SI5I/dvv/TzZrvE+YON8kQ8AtNuNB3NNa4xWzLOviiiaZyYVyg0MlDBh z3yBy8gW8FNTq2pl/njDRYqBojVV62QgvcOVD4u0/FrgifkbLlN3Yfr+4Kqftzn7etkR wmog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=LUmEFVgYyEJd0Y33BFcDH3/Ea1qs67OuZS/yeIuLfWU=; fh=jNulKcNNNZRBBBK3rrqTKbW2ILwpaKJDZvRm4Dk0YJw=; b=iUBxLNJe5KtDDcOqANfIthv5yLCARUA+OeJJy3/KnZQCjtxLh5+kVtkQYG1YqxHMDc hwnRY39VLOvihX9cHWpV6sn35TZ4/T++4kPlKWLXc2s6IZD57vzesaEBA3MOX7TNSdLm uZFe4JKFEgBv6Xp7Dz976gKXADCH6D/Ppr2fB7RsmRMDT0jVukHRw0XOjflwl9SDKdpY sfthMLleN/ApIm8J2QpoRIBTcdpBy3J+DFltXTN8tgldm87BjvhgiV2Zd5cfsrXVCqBL MuibC8r3JhrHKhvy2qGv7qR0oGaUnlTslNKy3eoVwZBC2etqmbUFHv/d7szxos8yV0DW 4RJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@inria.fr header.s=dc header.b=BazJQIym; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=inria.fr Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id e21-20020a656895000000b0056da0ae25a0si17753245pgt.441.2023.09.28.04.40.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 04:40:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@inria.fr header.s=dc header.b=BazJQIym; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=inria.fr Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id D887180A2211; Thu, 28 Sep 2023 03:44:07 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231602AbjI1Kn5 (ORCPT <rfc822;pwkd43@gmail.com> + 21 others); Thu, 28 Sep 2023 06:43:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231313AbjI1Kn4 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 28 Sep 2023 06:43:56 -0400 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EADB1180; Thu, 28 Sep 2023 03:43:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=LUmEFVgYyEJd0Y33BFcDH3/Ea1qs67OuZS/yeIuLfWU=; b=BazJQIymVfr5MFVaqLBBi67mhojX2DO/rPD82cWOq356vfv2M/l0jLWg oJ8FlNpA9Cx7ICaWWIlXMPfunCGOV7yT7ruP/0K49sedyoeoT91AsWbD0 wLJs2Xm5jAJ9PUEhj0qWza4Y6JkUwvHXr+1qcgIDUt7bFiygz+tH6V/OV 4=; Authentication-Results: mail3-relais-sop.national.inria.fr; dkim=none (message not signed) header.i=none; spf=SoftFail smtp.mailfrom=Julia.Lawall@inria.fr; dmarc=fail (p=none dis=none) d=inria.fr X-IronPort-AV: E=Sophos;i="6.03,183,1694728800"; d="scan'208";a="67216334" Received: from i80.paris.inria.fr (HELO i80.paris.inria.fr.) ([128.93.90.48]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2023 12:43:50 +0200 From: Julia Lawall <Julia.Lawall@inria.fr> To: Steven Rostedt <rostedt@goodmis.org> Cc: kernel-janitors@vger.kernel.org, Masami Hiramatsu <mhiramat@kernel.org>, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Subject: [PATCH] tracing/eprobe: drop unneeded breaks Date: Thu, 28 Sep 2023 12:43:34 +0200 Message-Id: <20230928104334.41215-1-Julia.Lawall@inria.fr> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 28 Sep 2023 03:44:07 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778281339210892911 X-GMAIL-MSGID: 1778281339210892911 |
Series |
tracing/eprobe: drop unneeded breaks
|
|
Commit Message
Julia Lawall
Sept. 28, 2023, 10:43 a.m. UTC
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(-)
Comments
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; > } >
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> >
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> > >
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
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; }