summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/powerpc/pmu
diff options
context:
space:
mode:
authorPeter Senna Tschudin <peter.senna@gmail.com>2016-11-09 11:55:04 +0300
committerMichael Ellerman <mpe@ellerman.id.au>2016-11-14 12:06:00 +0300
commit0e27d27e0d6d92342797e0d37738c276c1ff090e (patch)
tree462e004ad4fc6967b4d3514e6711c8d6f49387a0 /tools/testing/selftests/powerpc/pmu
parent99e5cde5eae78bef95bfe7c16ccda87fb070149b (diff)
downloadlinux-0e27d27e0d6d92342797e0d37738c276c1ff090e.tar.xz
selftests/powerpc: Return false instead of -1 in require_paranoia_below()
Returning a negative value for a boolean function seem to have the undesired effect of returning true. require_paranoia_below() is a boolean function, but the variable used to store the return value is an integer, receiving -1 or 0. This patch converts rc to bool, replaces -1 by false, and 0 by true. mpe: This wasn't exhibiting in practice because the common case, where we do the comparison of the desired level vs the current value, was being compiled into a computation based on the result of the comparison, ie. it wasn't using the default -1 value at all. However that was just luck and the code is still wrong. Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com> Signed-off-by: Andrew Shadura <andrew.shadura@collabora.co.uk> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'tools/testing/selftests/powerpc/pmu')
-rw-r--r--tools/testing/selftests/powerpc/pmu/lib.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/testing/selftests/powerpc/pmu/lib.c b/tools/testing/selftests/powerpc/pmu/lib.c
index 8b992fa5b478..5bf5dd40822b 100644
--- a/tools/testing/selftests/powerpc/pmu/lib.c
+++ b/tools/testing/selftests/powerpc/pmu/lib.c
@@ -193,9 +193,9 @@ bool require_paranoia_below(int level)
long current;
char *end, buf[16];
FILE *f;
- int rc;
+ bool rc;
- rc = -1;
+ rc = false;
f = fopen(PARANOID_PATH, "r");
if (!f) {
@@ -218,7 +218,7 @@ bool require_paranoia_below(int level)
if (current >= level)
goto out_close;
- rc = 0;
+ rc = true;
out_close:
fclose(f);
out: