checkpatch: fix "Use of uninitialized value" warnings
authorJoe Perches <[email protected]>
Thu, 21 Nov 2013 22:31:57 +0000 (14:31 -0800)
committerLinus Torvalds <[email protected]>
Fri, 22 Nov 2013 00:42:27 +0000 (16:42 -0800)
checkpatch is currently confused about some complex macros and references
undefined variables $stat and $cond.

Make sure these are defined before using them.

Signed-off-by: Joe Perches <[email protected]>
Reported-by: Gerhard Sittig <[email protected]>
Acked-by: Andy Whitcroft <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
scripts/checkpatch.pl

index 61090e0ff613aefeb5429c26d4efc7775ad97739..9c98100303774cd228ad83f3ff7bfcaeeb7af6fd 100755 (executable)
@@ -3289,6 +3289,7 @@ sub process {
                        }
                }
                if (!defined $suppress_whiletrailers{$linenr} &&
+                   defined($stat) && defined($cond) &&
                    $line =~ /\b(?:if|while|for)\s*\(/ && $line !~ /^.\s*#/) {
                        my ($s, $c) = ($stat, $cond);