If coccicheck finds errors, it should return an error code distinct from zero. Current code instead of exiting with an error code of coccinelle returns error code of 'echo "coccicheck failed"' which is almost always equals to zero, thus failing original intention of alerting about errors. This patch fixes the problem.
Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Denis Efremov <efre...@linux.com> --- scripts/coccicheck | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/coccicheck b/scripts/coccicheck index 9fedca611b7f..e04d328210ac 100755 --- a/scripts/coccicheck +++ b/scripts/coccicheck @@ -128,9 +128,10 @@ run_cmd_parmap() { fi echo $@ >>$DEBUG_FILE $@ 2>>$DEBUG_FILE - if [[ $? -ne 0 ]]; then + err=$? + if [[ $err -ne 0 ]]; then echo "coccicheck failed" - exit $? + exit $err fi } -- 2.17.1