[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <546A2C5C.8080800@users.sourceforge.net>
Date: Mon, 17 Nov 2014 18:11:56 +0100
From: SF Markus Elfring <elfring@...rs.sourceforge.net>
To: Arnaldo Carvalho de Melo <acme@...nel.org>,
Ingo Molnar <mingo@...hat.com>,
Paul Mackerras <paulus@...ba.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>
CC: LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org, Coccinelle <cocci@...teme.lip6.fr>
Subject: [PATCH 1/1] perf tools: Deletion of unnecessary checks before two
function calls
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Mon, 17 Nov 2014 18:05:57 +0100
The functions free_event_desc() and strfilter__delete() test whether their
argument is NULL and then return immediately. Thus the test around the call
is not needed.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
tools/perf/builtin-probe.c | 6 ++----
tools/perf/util/header.c | 3 +--
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index c63fa29..1b72bf2 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -254,8 +254,7 @@ static int opt_set_filter(const struct option *opt __maybe_unused,
if (str) {
pr_debug2("Set filter: %s\n", str);
- if (params.filter)
- strfilter__delete(params.filter);
+ strfilter__delete(params.filter);
params.filter = strfilter__new(str, &err);
if (!params.filter) {
pr_err("Filter parse error at %td.\n", err - str + 1);
@@ -283,8 +282,7 @@ static void cleanup_params(void)
strlist__delete(params.dellist);
line_range__clear(¶ms.line_range);
free(params.target);
- if (params.filter)
- strfilter__delete(params.filter);
+ strfilter__delete(params.filter);
memset(¶ms, 0, sizeof(params));
}
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 158c787..a62fbc6 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -1367,8 +1367,7 @@ out:
free(buf);
return events;
error:
- if (events)
- free_event_desc(events);
+ free_event_desc(events);
events = NULL;
goto out;
}
--
2.1.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists