]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
checkpatch: fix extraneous EXPORT_SYMBOL* warnings
authorPatrick Pannuto <ppannuto@codeaurora.org>
Tue, 10 Aug 2010 00:21:03 +0000 (17:21 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 10 Aug 2010 03:45:09 +0000 (20:45 -0700)
These are caused by checkpatch incorrectly parsing its internal
representation of a statement block for struct's (or anything else that is
a statement block encapsulated in {}'s that also ends with a ';').  Fix
this by properly parsing a statement block.

An example:

+struct dummy_type dummy = {
+ .foo = "baz",
+};
+EXPORT_SYMBOL_GPL(dummy);
+
+static int dummy_func(void)
+{
+ return -EDUMMYCODE;
+}
+EXPORT_SYMBOL_GPL(dummy_func);

WARNING: EXPORT_SYMBOL(foo); should immediately \
follow its function/variable
#19: FILE: dummy.c:4:
+EXPORT_SYMBOL_GPL(dummy);

The above warning is issued when it should not be.

Signed-off-by: Patrick Pannuto <ppannuto@codeaurora.org>
Cc: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
scripts/checkpatch.pl

index dd11bbe01338ba810cd873f9f5c77b593712100c..2039acdf51222b3961b06291d6a02f4a8105a240 100755 (executable)
@@ -558,6 +558,9 @@ sub ctx_statement_block {
                        $type = ($level != 0)? '{' : '';
 
                        if ($level == 0) {
+                               if (substr($blk, $off + 1, 1) eq ';') {
+                                       $off++;
+                               }
                                last;
                        }
                }