Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

coccicheck: return proper error code on fail

If coccicheck fails, it should return an error code distinct from zero
to signal about an internal problem. Current code instead of exiting with
the tool's error code returns the error code of 'echo "coccicheck failed"'
which is almost always equals to zero, thus failing the original intention
of alerting about a problem. This patch fixes the code.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Denis Efremov <efremov@linux.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

authored by

Denis Efremov and committed by
Masahiro Yamada
512ddf7d 09d4d964

+3 -2
+3 -2
scripts/coccicheck
··· 128 128 fi 129 129 echo $@ >>$DEBUG_FILE 130 130 $@ 2>>$DEBUG_FILE 131 - if [[ $? -ne 0 ]]; then 131 + err=$? 132 + if [[ $err -ne 0 ]]; then 132 133 echo "coccicheck failed" 133 - exit $? 134 + exit $err 134 135 fi 135 136 } 136 137