aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Senna Tschudin <[email protected]>2015-09-17 12:08:53 +0200
committerArnaldo Carvalho de Melo <[email protected]>2015-09-17 15:31:52 -0300
commitbf6445631c6f00882b25516a174d5073ce0c6f81 (patch)
tree8a1538b1c9f1e00761c71a1d3989e53de796c8cf
parentb0063dbfb031a7c728ed0d9533257e8329292cf1 (diff)
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: <smpl> @@ identifier f; constant C; typedef bool; @@ bool f (...){ <+... * return -C; ...+> } </smpl> Signed-off-by: Peter Senna Tschudin <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Kan Liang <[email protected]> Cc: Matt Fleming <[email protected]> Cc: Milos Vyletel <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Steven Rostedt <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
-rw-r--r--tools/perf/util/util.c2
1 files changed, 1 insertions, 1 deletions
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) {