On 10/27/20 5:15 AM, Srinivas Kandagatla wrote:
Thanks Pierre for review on all the patches.
On 26/10/2020 19:58, Pierre-Louis Bossart wrote:
Run cppcheck on this sort of code:
cppcheck --platform=unix32 --force --max-configs=1024 --inconclusive --enable=all --suppress=variableScope sound/soc/codecs/lpass-wsa-macro.c
I normally do sparse checks before sending patches, which did not catch these.
thanks for the suggestion, I will keep add these checks to my future patches.
Each tool has its own merits and strengths.
My routine is
export KCFLAGS="-Wall -Werror" make W=1 sound/ this typically catches set-but-not-used assignments, kernel-doc, etc. make C=2 sound/ Sparse catches big-little issues and when static should be used. and the cppcheck last. this is a bit verbose and not suitable for CI/automation, but catches set-but-ignored assignments and differences between declarations and definitions. It also catches logical errors (always true, always-false, etc).
Hope this helps -Pierre