From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752889AbbIQSzE (ORCPT ); Thu, 17 Sep 2015 14:55:04 -0400 Received: from casper.infradead.org ([85.118.1.10]:36249 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752277AbbIQSy7 (ORCPT ); Thu, 17 Sep 2015 14:54:59 -0400 From: Arnaldo Carvalho de Melo To: Ingo Molnar Cc: linux-kernel@vger.kernel.org, Peter Senna Tschudin , Jiri Olsa , Kan Liang , Matt Fleming , Milos Vyletel , Namhyung Kim , Peter Zijlstra , Steven Rostedt , Arnaldo Carvalho de Melo Subject: [PATCH 5/5] perf tools: Bool functions shouldn't return -1 Date: Thu, 17 Sep 2015 15:54:32 -0300 Message-Id: <1442516072-27033-6-git-send-email-acme@kernel.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1442516072-27033-1-git-send-email-acme@kernel.org> References: <1442516072-27033-1-git-send-email-acme@kernel.org> X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peter Senna Tschudin 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 7acafb3c5592..c2cd9bf2348b 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) { -- 2.1.0