When one attempts to build an out-of-tree/proprietary kernel module, it may not build or work… Static code analysis is a great way to find bugs and therefore improve product quality. One of my preferred code analysis tools is scan-build (aka clang-analyzer) because its easy to use and has great HTML output. All one has to do is prepend scan-build to your build command: scan-build make. Unfortunately, the LLVM compiler infrastructure doesn’t support the gcc extension asm goto. Therefore, if your kernel was compiled with CONFIG_JUMP_LABEL set, there will probably be numerous errors from scan-build. Fortunately, there is a workaround: undefine CC_HAVE_ASM_GOTO.

Example command-line to analyze a kernel module with scan-build.
scan-build make CFLAGS="-UCC_HAVE_ASM_GOTO"