30 Apr, 2013

6 commits

  • As people started using Suggested-by as standard signature, adding
    "Suggested-by" to the standard signature so that checkpatch won't
    generate warning when Suggested-by is used in patch signature

    Signed-off-by: Mugunthan V N
    Cc: Andy Whitcroft
    Cc: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mugunthan V N
     
  • This check was intended to catch extra newlines at the end of a function
    definition, but it would trigger on any closing brace, including those
    of inline functions and macro definitions, triggering false positives.
    Now, only closing braces on a line by themselves trigger this check.

    Tested with:

    $ cat test.h
    /* test.h - Test file */

    static inline int foo(void) { return 0; }

    static inline int bar(void)
    {
    return 1;

    }

    $ ./scripts/checkpatch.pl --strict -f test.h # Before this commit
    CHECK: Blank lines aren't necessary before a close brace '}'
    +
    +static inline int foo(void) { return 0; }

    CHECK: Blank lines aren't necessary before a close brace '}'
    +
    +}

    total: 0 errors, 0 warnings, 2 checks, 9 lines checked

    $ ./scripts/checkpatch.pl --strict -f test.h # After this commit
    CHECK: Blank lines aren't necessary before a close brace '}'
    +
    +}

    total: 0 errors, 0 warnings, 1 checks, 9 lines checked

    Signed-off-by: Matthijs Kooijman
    Cc: Andy Whitcroft
    Acked-by: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Matthijs Kooijman
     
  • Make space before semicolon a warning instead of a --strict CHK test.

    Signed-off-by: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • Complain about files with an executable bit set that are not in a scripts/
    directory and are not type .pl, .py, .awk, or .sh

    Based on an initial patch from Stephen.

    Signed-off-by: Joe Perches
    Acked-by: Stephen Boyd
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • Add a check for seq_printf use with a constant format without additional
    arguments. Suggest seq_puts instead.

    Signed-off-by: Joe Perches
    Suggested-by: Bjorn Helgaas
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • On Thu, 2013-03-14 at 13:30 +0000, David Woodhouse wrote:
    > If krealloc() returns NULL, it *doesn't* free the original. So any code
    > of the form 'foo = krealloc(foo, …);' is almost certainly a bug.

    So add a check for it to checkpatch.

    Signed-off-by: Joe Perches
    Tested-by: Guenter Roeck
    Acked-by: Guenter Roeck
    Cc: David Woodhouse
    Cc: Andy Whitcroft
    Cc: Jean Delvare
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     

18 Apr, 2013

1 commit

  • Fix checkpatch misreporting defect with stringification macros

    ERROR: Macros with complex values should be enclosed in parenthesis
    #27: FILE: arch/arm/include/asm/kgdb.h:41:
    +#define ___to_string(X) #X

    Signed-off-by: Joe Perches
    Reported-by: Vincent Stehlé
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     

28 Feb, 2013

1 commit


22 Feb, 2013

5 commits


05 Feb, 2013

1 commit

  • Commit 74349bccedb3 ("checkpatch: add support for floating point
    constants") added an unnecessary match variable that caused tests that
    used a $Constant or $LvalOrFunc to have one too many matches.

    This causes problems with usleep_range, min/max and other extended
    tests.

    Avoid using match variables in $Float.
    Avoid using match variables in $Assignment too.

    Signed-off-by: Joe Perches
    Cc: Andy Whitcroft
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     

21 Dec, 2012

1 commit


18 Dec, 2012

12 commits


09 Nov, 2012

1 commit

  • Some comment styles in net and drivers/net are flagged inappropriately.

    Avoid proclaiming inline comments like:
    int a = b; /* some comment */
    and block comments like:
    /*********************
    * some comment
    ********************/
    are defective.

    Tested with
    $ cat drivers/net/t.c
    /* foo */

    /*
    * foo
    */

    /* foo
    */

    /* foo
    * bar */

    /****************************
    * some long block comment
    ***************************/

    struct foo {
    int bar; /* another test */
    };
    $

    Signed-off-by: Joe Perches
    Reported-by: Larry Finger
    Cc: David Miller
    Cc: Stephen Hemminger
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     

06 Oct, 2012

4 commits

  • Fix macro name in checkpatch: s/PARAM/PARM/.

    Signed-off-by: Kees Cook
    Cc: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Kees Cook
     
  • In an effort to get fewer checkpatch reviewer corrections, add a
    networking specific style test for the preferred networking comment style.

    /* The preferred style for block comments in
    * drivers/net/... and net/... is like this
    */

    These tests are only used in net/ and drivers/net/

    Tested with:

    $ cat drivers/net/t.c

    /* foo */

    /*
    * foo
    */

    /* foo
    */

    /* foo
    * bar */
    $ ./scripts/checkpatch.pl -f drivers/net/t.c
    WARNING: networking block comments don't use an empty /* line, use /* Comment...
    #4: FILE: net/t.c:4:
    +
    +/*

    WARNING: networking block comments put the trailing */ on a separate line
    #12: FILE: net/t.c:12:
    + * bar */

    total: 0 errors, 2 warnings, 12 lines checked

    Signed-off-by: Joe Perches
    Cc: "Allan, Bruce W"
    Cc: Andy Whitcroft
    Cc: David Miller
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • Direct conversion of printk(KERN_... to pr_ isn't the
    preferred conversion when a struct net_device or struct device is
    available.

    Hint that using netdev_ or dev_ is preferred to using
    pr_. Add netdev_dbg and dev_dbg variants too.

    Miscellaneous whitespace neatening of a misplaced close brace.

    Signed-off-by: Joe Perches
    Cc: Andy Whitcroft
    Cc: Greg KH
    Cc: Dan Carpenter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • Check that a commit log doesn't contain UTF-8 when a mail header
    explicitly defines a different charset, like

    'Content-Type: text/plain; charset="us-ascii"'

    Signed-off-by: Pasi Savanainen
    Cc: Joe Perches
    Cc: Andy Whitcroft
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Pasi Savanainen
     

22 Aug, 2012

1 commit

  • Commit b13edf7ff2dd ("checkpatch: add checks for do {} while (0) macro
    misuses") added a test that is overly simplistic for single statement
    macros.

    Macros that start with control tests should be enclosed in a do {} while
    (0) loop.

    Add the necessary control tests to the check.

    Signed-off-by: Joe Perches
    Acked-by: Andy Whitcroft
    Tested-by: Franz Schrober
    Cc: Stephen Rothwell
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     

31 Jul, 2012

5 commits


01 Jun, 2012

2 commits

  • Suggest the shorter pr_ instead of printk(KERN_.

    Prefer to use pr_ over bare printks.
    Prefer to use pr_warn over pr_warning.

    Signed-off-by: Joe Perches
    Cc: Andy Whitcroft
    Cc: Theodore Ts'o
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • Requires --strict option during invocation:
    ~/linux$ scripts/checkpatch --strict foo.patch

    This tests for a bad habits of mine like this:

    return 0 ;

    Note that it does allow a special case of a bare semicolon
    for empty loops:

    while (foo())
    ;

    Signed-off-by: Eric Nelson
    Cc: Andy Whitcroft
    Cc: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Eric Nelson