From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752965AbbIRFuZ (ORCPT ); Fri, 18 Sep 2015 01:50:25 -0400 Received: from terminus.zytor.com ([198.137.202.10]:43052 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752910AbbIRFuW (ORCPT ); Fri, 18 Sep 2015 01:50:22 -0400 Date: Thu, 17 Sep 2015 22:49:51 -0700 From: tip-bot for Peter Senna Tschudin Message-ID: Cc: kan.liang@intel.com, namhyung@kernel.org, hpa@zytor.com, linux-kernel@vger.kernel.org, milos@redhat.com, acme@redhat.com, peter.senna@gmail.com, matt.fleming@intel.com, tglx@linutronix.de, rostedt@goodmis.org, a.p.zijlstra@chello.nl, mingo@kernel.org, jolsa@kernel.org Reply-To: milos@redhat.com, acme@redhat.com, linux-kernel@vger.kernel.org, hpa@zytor.com, peter.senna@gmail.com, namhyung@kernel.org, kan.liang@intel.com, tglx@linutronix.de, matt.fleming@intel.com, jolsa@kernel.org, a.p.zijlstra@chello.nl, mingo@kernel.org, rostedt@goodmis.org In-Reply-To: <1442484533-19742-1-git-send-email-peter.senna@gmail.com> References: <1442484533-19742-1-git-send-email-peter.senna@gmail.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] perf tools: Bool functions shouldn't return -1 Git-Commit-ID: bf6445631c6f00882b25516a174d5073ce0c6f81 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: bf6445631c6f00882b25516a174d5073ce0c6f81 Gitweb: http://git.kernel.org/tip/bf6445631c6f00882b25516a174d5073ce0c6f81 Author: Peter Senna Tschudin AuthorDate: Thu, 17 Sep 2015 12:08:53 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Thu, 17 Sep 2015 15:31:52 -0300 perf tools: Bool functions shouldn't return -1 Returning a negative value for a boolean function seem to have the undesired effect of returning true. Replace -1 by false in a bool-returning function. The diff of the .s file before and after the change (for x86_64): 3907c3907 < movl $1, %ebx --- > xorl %ebx, %ebx while if -1 is replaced by true, the diff is empty. This issue was found by the following Coccinelle semantic patch: @@ identifier f; constant C; typedef bool; @@ bool f (...){ <+... * return -C; ...+> } Signed-off-by: Peter Senna Tschudin Cc: Jiri Olsa Cc: Kan Liang Cc: Matt Fleming Cc: Milos Vyletel Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Steven Rostedt Link: http://lkml.kernel.org/r/1442484533-19742-1-git-send-email-peter.senna@gmail.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c index 7acafb3..c2cd9bf2 100644 --- a/tools/perf/util/util.c +++ b/tools/perf/util/util.c @@ -709,7 +709,7 @@ bool find_process(const char *name) dir = opendir(procfs__mountpoint()); if (!dir) - return -1; + return false; /* Walk through the directory. */ while (ret && (d = readdir(dir)) != NULL) {