From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752610AbbIQSdR (ORCPT ); Thu, 17 Sep 2015 14:33:17 -0400 Received: from mail.kernel.org ([198.145.29.136]:51262 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752150AbbIQSdK (ORCPT ); Thu, 17 Sep 2015 14:33:10 -0400 Date: Thu, 17 Sep 2015 15:33:03 -0300 From: Arnaldo Carvalho de Melo To: Peter Senna Tschudin Cc: a.p.zijlstra@chello.nl, mingo@redhat.com, jolsa@kernel.org, matt.fleming@intel.com, namhyung@kernel.org, milos@redhat.com, kan.liang@intel.com, rostedt@goodmis.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] tools-perf: Change -1 by false Message-ID: <20150917183303.GO11551@kernel.org> References: <1442484533-19742-1-git-send-email-peter.senna@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1442484533-19742-1-git-send-email-peter.senna@gmail.com> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Thu, Sep 17, 2015 at 12:08:53PM +0200, Peter Senna Tschudin escreveu: > 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 > --- Please avoid adding a --- at the start of any changeset comment line, it breaks scripts. Thanks, applied. - Arnaldo > > 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 > --- > 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 49a5c6a..ce465b2 100644 > --- a/tools/perf/util/util.c > +++ b/tools/perf/util/util.c > @@ -639,7 +639,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