Patchwork [U-Boot] patman: Handle checkpatch.pl not providing file/line info

login
register
mail settings
Submitter Simon Glass
Date Sept. 28, 2012, 1:33 a.m.
Message ID <1348796026-25811-1-git-send-email-sjg@chromium.org>
Download mbox | patch
Permalink /patch/187693/
State Accepted, archived
Delegated to: Tom Rini
Headers show

Comments

Simon Glass - Sept. 28, 2012, 1:33 a.m.
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 |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
Tom Rini - Oct. 9, 2012, 5:15 p.m.
On Thu, Sep 27, 2012 at 03:33:46PM -0000, Simon Glass wrote:

> 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>

Applied to u-boot/next, thanks!

Patch

diff --git a/tools/patman/checkpatch.py b/tools/patman/checkpatch.py
index a234277..d831087 100644
--- a/tools/patman/checkpatch.py
+++ b/tools/patman/checkpatch.py
@@ -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)' % (