]> git.sur5r.net Git - u-boot/commitdiff
patman: Handle checkpatch.pl not providing file/line info
authorSimon Glass <sjg@chromium.org>
Thu, 27 Sep 2012 15:33:46 +0000 (15:33 +0000)
committerTom Rini <trini@ti.com>
Mon, 15 Oct 2012 18:54:04 +0000 (11:54 -0700)
Sometimes we don't get a valid filename or line number from checkpatch.pl,
for example if the patch is in a bad format. Deal with this by using a
default value, rather than a stack trace.

Signed-off-by: Simon Glass <sjg@chromium.org>
tools/patman/checkpatch.py

index a234277177866f58d75df0d0048f691beeba8c00..d831087d88b39706b6afee2e70d79ecc8fe434ca 100644 (file)
@@ -145,8 +145,9 @@ def CheckPatches(verbose, args):
             if len(problems) != error_count + warning_count:
                 print "Internal error: some problems lost"
             for item in problems:
-                print GetWarningMsg(col, item['type'], item['file'],
-                        item['line'], item['msg'])
+                print GetWarningMsg(col, item['type'],
+                        item.get('file', '<unknown>'),
+                        item.get('line', 0), item['msg'])
             #print stdout
     if error_count != 0 or warning_count != 0:
         str = 'checkpatch.pl found %d error(s), %d warning(s)' % (