Skip to content

Commit

Permalink
scripts/checkpatch.pl: add check for multiple terminating semicolons …
Browse files Browse the repository at this point in the history
…and casts of vmalloc

Signed-off-by: Joe Perches <[email protected]>
Cc: Andy Whitcroft <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
JoePerches authored and torvalds committed Jan 13, 2011
1 parent 78c377d commit caf2a54
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion scripts/checkpatch.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit caf2a54

Please sign in to comment.