checkpatch: check for nested (un)?likely() calls
[linux-2.6-block.git] / scripts / checkpatch.pl
index 4eb355d8ae730529228664f9f028eac6c558fc5d..6fcc66afb088083080a4b492be6af4b67d4c1430 100755 (executable)
@@ -6507,6 +6507,12 @@ sub process {
                             "Using $1 should generally have parentheses around the comparison\n" . $herecurr);
                }
 
+# nested likely/unlikely calls
+               if ($line =~ /\b(?:(?:un)?likely)\s*\(\s*!?\s*(IS_ERR(?:_OR_NULL|_VALUE)?|WARN)/) {
+                       WARN("LIKELY_MISUSE",
+                            "nested (un)?likely() calls, $1 already uses unlikely() internally\n" . $herecurr);
+               }
+
 # whine mightly about in_atomic
                if ($line =~ /\bin_atomic\s*\(/) {
                        if ($realfile =~ m@^drivers/@) {