]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - scripts/checkpatch.pl
Merge tag 'v2.6.38' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[mv-sheeva.git] / scripts / checkpatch.pl
index e3c7fc0dca382492f1714f4879abb37b63cc07f2..4c0383da1c9a22087853e423875b7829f03f87ac 100755 (executable)
@@ -859,7 +859,7 @@ sub annotate_values {
                                $av_preprocessor = 0;
                        }
 
-               } elsif ($cur =~ /^(\(\s*$Type\s*)\)/) {
+               } elsif ($cur =~ /^(\(\s*$Type\s*)\)/ && $av_pending eq '_') {
                        print "CAST($1)\n" if ($dbg_values > 1);
                        push(@av_paren_type, $type);
                        $type = 'C';
@@ -2743,6 +2743,11 @@ sub process {
                        WARN("plain inline is preferred over $1\n" . $herecurr);
                }
 
+# Check for __attribute__ packed, prefer __packed
+               if ($line =~ /\b__attribute__\s*\(\s*\(.*\bpacked\b/) {
+                       WARN("__packed is preferred over __attribute__((packed))\n" . $herecurr);
+               }
+
 # check for sizeof(&)
                if ($line =~ /\bsizeof\s*\(\s*\&/) {
                        WARN("sizeof(& should be avoided\n" . $herecurr);
@@ -2785,10 +2790,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);
@@ -2892,6 +2902,11 @@ sub process {
                                ERROR("lockdep_no_validate class is reserved for device->mutex.\n" . $herecurr);
                        }
                }
+
+               if ($line =~ /debugfs_create_file.*S_IWUGO/ ||
+                   $line =~ /DEVICE_ATTR.*S_IWUGO/ ) {
+                       WARN("Exporting world writable files is usually an error. Consider more restrictive permissions.\n" . $herecurr);
+               }
        }
 
        # If we have no input at all, then there is nothing to report on