]> git.baikalelectronics.ru Git - kernel.git/commit
selftests/powerpc: Return false instead of -1 in require_paranoia_below()
authorPeter Senna Tschudin <peter.senna@gmail.com>
Wed, 9 Nov 2016 08:55:04 +0000 (09:55 +0100)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 14 Nov 2016 09:06:00 +0000 (20:06 +1100)
commitc019e036626362bbfa6ea8defb3439b8e534793c
tree462e004ad4fc6967b4d3514e6711c8d6f49387a0
parentbead22e92bab1ac1ceb260f7e9ad300c2ea4a75d
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>
tools/testing/selftests/powerpc/pmu/lib.c