Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751677AbaKQRMO (ORCPT ); Mon, 17 Nov 2014 12:12:14 -0500 Received: from mout.web.de ([212.227.17.12]:52098 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750920AbaKQRMM (ORCPT ); Mon, 17 Nov 2014 12:12:12 -0500 Message-ID: <546A2C5C.8080800@users.sourceforge.net> Date: Mon, 17 Nov 2014 18:11:56 +0100 From: SF Markus Elfring User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Arnaldo Carvalho de Melo , Ingo Molnar , Paul Mackerras , Peter Zijlstra CC: LKML , kernel-janitors@vger.kernel.org, Coccinelle Subject: [PATCH 1/1] perf tools: Deletion of unnecessary checks before two function calls References: <5307CAA2.8060406@users.sourceforge.net> <530A086E.8010901@users.sourceforge.net> <530A72AA.3000601@users.sourceforge.net> <530B5FB6.6010207@users.sourceforge.net> <530C5E18.1020800@users.sourceforge.net> <530CD2C4.4050903@users.sourceforge.net> <530CF8FF.8080600@users.sourceforge.net> <530DD06F.4090703@users.sourceforge.net> <5317A59D.4@users.sourceforge.net> In-Reply-To: <5317A59D.4@users.sourceforge.net> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:2MwEubM/gfjlZY0lMiHpoyfFW6K84l2YQQFIqGlewcvBCm6+LBg G3w/YuEpbpfM1NfqqZRu5fWkkEgqILmIvr7DN6yyRXlBvv49s4ezXBpJ06ANtVYYeotz6d1 CutI5aNbjVMQI4nejev1xk4VyECQN8LI/VKyYl/Rp9PhqdIcTk4be+PVye1BE72hgesmZhk COP1ajxTWZdtJSXRELqQw== X-UI-Out-Filterresults: notjunk:1; Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Markus Elfring 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 --- 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/