summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2010-03-05 22:43:48 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2010-03-06 20:26:44 +0100
commit8f53a9b80f011080555c498d2ca2dc6b1a77c42c (patch)
treeb4636535f12817c107ba8fc1932882984eee9e46 /scripts
parentmmc: enable DMA on Ricoh sdhci reader by default (diff)
downloadlinux-8f53a9b80f011080555c498d2ca2dc6b1a77c42c.tar.xz
linux-8f53a9b80f011080555c498d2ca2dc6b1a77c42c.zip
scripts/checkpatch.pl: add WARN on sizeof(&foo)
sizeof(&foo) is frequently an error. Warn on its use. 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>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/checkpatch.pl5
1 files changed, 5 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 3257d3d96767..309050f30874 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2572,6 +2572,11 @@ sub process {
WARN("plain inline is preferred over $1\n" . $herecurr);
}
+# check for sizeof(&)
+ if ($line =~ /\bsizeof\s*\(\s*\&/) {
+ WARN("sizeof(& should be avoided\n" . $herecurr);
+ }
+
# check for new externs in .c files.
if ($realfile =~ /\.c$/ && defined $stat &&
$stat =~ /^.\s*(?:extern\s+)?$Type\s+($Ident)(\s*)\(/s)