Commit caf2a54f authored by Joe Perches's avatar Joe Perches Committed by Linus Torvalds

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

Signed-off-by: default avatarJoe Perches <joe@perches.com>
Cc: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 78c377d1
...@@ -2785,10 +2785,15 @@ sub process { ...@@ -2785,10 +2785,15 @@ sub process {
} }
# check for pointless casting of kmalloc return # 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); 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__ # check for gcc specific __FUNCTION__
if ($line =~ /__FUNCTION__/) { if ($line =~ /__FUNCTION__/) {
WARN("__func__ should be used instead of gcc specific __FUNCTION__\n" . $herecurr); WARN("__func__ should be used instead of gcc specific __FUNCTION__\n" . $herecurr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment