From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
Peter Senna Tschudin <peter.senna@gmail.com>,
Jiri Olsa <jolsa@kernel.org>, Kan Liang <kan.liang@intel.com>,
Matt Fleming <matt.fleming@intel.com>,
Milos Vyletel <milos@redhat.com>,
Namhyung Kim <namhyung@kernel.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Steven Rostedt <rostedt@goodmis.org>,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 5/5] perf tools: Bool functions shouldn't return -1
Date: Thu, 17 Sep 2015 15:54:32 -0300 [thread overview]
Message-ID: <1442516072-27033-6-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1442516072-27033-1-git-send-email-acme@kernel.org>
From: Peter Senna Tschudin <peter.senna@gmail.com>
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:
<smpl>
@@
identifier f;
constant C;
typedef bool;
@@
bool f (...){
<+...
* return -C;
...+>
}
</smpl>
Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Matt Fleming <matt.fleming@intel.com>
Cc: Milos Vyletel <milos@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1442484533-19742-1-git-send-email-peter.senna@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
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
next prev parent reply other threads:[~2015-09-17 18:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-17 18:54 [GIT PULL 0/5] perf/urgent fixes Arnaldo Carvalho de Melo
2015-09-17 18:54 ` [PATCH 1/5] perf stat: Fix per-pkg event reporting bug Arnaldo Carvalho de Melo
2015-09-17 18:54 ` [PATCH 2/5] Revert "perf symbols: Fix mismatched declarations for elf_getphdrnum" Arnaldo Carvalho de Melo
2015-09-17 18:54 ` [PATCH 3/5] tools build: Add test for presence of numa_num_possible_cpus() in libnuma Arnaldo Carvalho de Melo
2015-09-17 18:54 ` [PATCH 4/5] tools build: Add test for presence of __get_cpuid() gcc builtin Arnaldo Carvalho de Melo
2015-09-17 18:54 ` Arnaldo Carvalho de Melo [this message]
2015-09-18 5:46 ` [GIT PULL 0/5] perf/urgent fixes Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1442516072-27033-6-git-send-email-acme@kernel.org \
--to=acme@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=matt.fleming@intel.com \
--cc=milos@redhat.com \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=peter.senna@gmail.com \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.