11 Jun, 2015

1 commit

  • Commit d5e616fc1c1d ("checkpatch: add a few more --fix corrections")
    broke the GLOBAL_INITIALISERS test with bad parentheses and optional
    leading spaces.

    Fix it.

    Signed-off-by: Joe Perches
    Reported-by: Bandan Das
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     

17 Apr, 2015

16 commits

  • Since commit 1f65f947a6a8 ("checkpatch: add checks for question mark and
    colon spacing") back in 2008, checkpatch has reported false positive for
    asm volatile uses of "::" checkpatch thinks colons should always have
    spaces around it.

    Add an exception for colons with colons on either side for this valid asm
    volatile (and c++) use.

    Signed-off-by: Joe Perches
    Reported-by: Yehuda Yitschak
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • If a patch touches multiple files, the --fix and --fix-inplace option
    doesn't keep the proper line count and makes the new patch file not able
    to be applied via bad offset line numbers when lines are added or deleted
    by the --fix option.

    Dunno how that extra backslash snuck in there.

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

    Joe Perches
     
  • ENOSYS means that a nonexistent system call was called. We have a
    bad habit of using it for things like invalid operations on
    otherwise valid syscalls. We should avoid this in new code.

    Pervasive incorrect usage of ENOSYS came up at the kernel summit ABI
    review discussion. Let's see if checkpatch can help.

    I'll submit a separate patch for include/uapi/asm-generic/errno.h.

    Signed-off-by: Andy Lutomirski
    Cc: Pavel Machek
    Cc: Michael Kerrisk
    Cc: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Lutomirski
     
  • const objects shouldn't be __read_mostly. They are read-only.

    Marking these objects as __read_mostly causes section conflicts with LTO
    linking.

    So add a test to try to avoid this issue.

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

    Joe Perches
     
  • Code such as:
    x = timercmp(&now, &end,
    Cc: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Sam Bobroff
     
  • Add a test for sizeof(foo)/sizeof(foo[0]) that could be ARRAY_SIZE(foo).

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

    Joe Perches
     
  • Add another struct to the list of normally const struct types

    Signed-off-by: Joe Perches
    Cc: Andy Whitcroft
    Cc: Maxime Coquelin
    Cc: Greg Kroah-Hartman
    Cc: Jiri Slaby
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • There are #defines with long string constants like:
    #define foo "some really long string > 80 columns"
    Add a long line exception for them.

    Miscellanea:

    Use the $String variable for slightly better readability

    Signed-off-by: Joe Perches
    Reported-by: Madalin-Cristian Bucur
    Cc: Andy Whitcroft
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • Commit messages lines are sometimes overly long.

    Suggest line wrapping at 75 columns so the default git commit log
    indentation of 4 plus the commit message text still fits on an 80 column
    screen.

    Add a checkpatch test for long commit messages lines too.

    Signed-off-by: Joe Perches
    Cc: David Miller
    Cc: Jonathan Corbet
    Cc: Ian Morris
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • Currently checkpatch warns when asm/file.h is included and linux/file.h
    exists. That conversion can be made when linux/file.h includes asm/file.h
    which is not always the case.(See signal.h)

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

    Fabian Frederick
     
  • Using 'const const *' is generally meant to be written 'const
    * const'.

    Add a test for the miswritten form.

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

    Joe Perches
     
  • Add a few conditions to the test to find
    return (ERRNO);

    Make the output message a bit less cryptic too.

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

    Joe Perches
     
  • Currently checkpatch will fuss if one uses world writable settings in
    debugfs files and DEVICE_ATTR uses by testing S_IWUGO but not testing
    S_IWOTH, S_IRWXUGO or S_IALLUGO.

    Extend the check to catch all cases exporting world writable permissions
    including octal values.

    [akpm@linux-foundation.org: remove stray $]
    Signed-off-by: Joe Perches
    Original-patch-by: Nicholas Mc Guire
    Cc: Guenter Roeck
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • If a codespell dictionary exists, use it if desired. default is off,
    maybe it could be turned on later.

    codespell's dictionary format allows multiple possible corrections, ignore
    that for now and only use the first suggestion.

    Also add \b to spelling test so that consecutive misspelled words
    are found properly.

    Signed-off-by: Joe Perches
    Cc: Andy Whitcroft
    Cc: Kees Cook
    Cc: Masanari Iida
    Cc: Lucas De Marchi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • Only commit log and patch additions are checked for typos and spelling
    errors currently. Add a check of the email subject line too.

    Signed-off-by: Joe Perches
    Suggested-by: Jani Nikula
    Tested-by: Jani Nikula
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • The "no space is necessary after a cast" sizeof exclusion doesn't work
    properly.

    The test reports a false positive for code like:

    BUILD_BUG_ON(sizeof(struct batadv_bla_claim_dst) != 6);

    Make it work, simplify the exclusions, and add some comments.

    Signed-off-by: Joe Perches
    Reported-by: Marek Lindner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     

14 Feb, 2015

18 commits


11 Dec, 2014

5 commits

  • Add --fix option to coalesce string fragments.

    This does not coalesce string fragments that have newline terminations or
    are otherwise exempted.

    Other miscellanea:

    o move all the string tests together.
    o fix get_quoted_string function for tab characters
    o fix concatination typo

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

    Joe Perches
     
  • It seems there are more and more uses of "if (!ptr)" in preference to "if
    (ptr == NULL)" so add a --strict test to emit a message when using the
    latter form.

    This also finds (ptr != NULL).

    Fix it too if desired.

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

    Joe Perches
     
  • Emit a warning when single line string coalescing occurs.

    Code that uses compiler string concatenation on a single line like:

    printk("foo" "bar");

    is generally better to read concatenated like:

    printk("foobar");

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

    Joe Perches
     
  • Using BIT(foo) and BIT_ULL(bar) is more common now. Suggest using these
    macros over #defines with 1<
    Cc: David Miller
    Cc: Jiri Pirko
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • Checkpatch flags CamelCase identifiers in strict mode, but it has a
    feature to ignore parts with only two characters to allow for SI units
    like mV or uA. Unfortunately, not all SI units fit in two characters, and
    not all are lower case followed by upper case.

    This patch adds hardcoded detection for frequency and 1024-based size
    units (Hz/KHz/MHz/GHz/THz and KiB/MiB/GiB/TiB), since allowing any three
    character combinations might be too lenient. The list can later be
    expanded as needed.

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

    Julius Werner