scripts/checkpatch.pl: add check for multiple terminating semicolons and casts of vmalloc

Signed-off-by: Joe Perches <joe@perches.com>
Cc: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Joe Perches 2011-01-12 16:59:56 -08:00 committed by Linus Torvalds
parent 78c377d1b5
commit caf2a54f10
1 changed files with 6 additions and 1 deletions

View File

@ -2785,10 +2785,15 @@ sub process {
}
# check for pointless casting of kmalloc return
if ($line =~ /\*\s*\)\s*k[czm]alloc\b/) {
if ($line =~ /\*\s*\)\s*[kv][czm]alloc(_node){0,1}\b/) {
WARN("unnecessary cast may hide bugs, see http://c-faq.com/malloc/mallocnocast.html\n" . $herecurr);
}
# check for multiple semicolons
if ($line =~ /;\s*;\s*$/) {
WARN("Statements terminations use 1 semicolon\n" . $herecurr);
}
# check for gcc specific __FUNCTION__
if ($line =~ /__FUNCTION__/) {
WARN("__func__ should be used instead of gcc specific __FUNCTION__\n" . $herecurr);