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
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 -
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 -
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 -
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 -
Code such as:
x = timercmp(&now, &end,
Cc: Joe Perches
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
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 -
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 -
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 -
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 -
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 -
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 -
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 -
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 -
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 -
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 -
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
14 Feb, 2015
18 commits
-
Uses of struct of_device_id are most commonly const.
Suggest using it as such.
Signed-off-by: Joe Perches
Acked-by: Rob Herring
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Naming the tool that found an issue in the subject line isn't very useful.
Emit a warning when a common tool (currently checkpatch, sparse or
smatch) is in the subject line.Signed-off-by: Joe Perches
Suggested-by: Al Viro
Acked-by: Dan Carpenter
Acked-by: Greg Kroah-Hartman
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
The preferred style for a commit reference in a commit log is:
commit ("")
A recent commit removed this check for parentheses. Add it back.
Signed-off-by: Joe Perches
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Some prefer code to have spaces around arithmetic so instead of:
a = b*c+d;
suggest
a = b * c + d;Signed-off-by: Joe Perches
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Just neatening...
Signed-off-by: Joe Perches
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Code like:
if (a < sizeof() &&
and
{ .len = sizeof() },incorrectly emits that warning, so add more exceptions to avoid
the warning.Signed-off-by: Joe Perches
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Improve the format specifier test by removing any %% before looking for
any remaining % format specifier.Signed-off-by: Heba Aamer
Signed-off-by: Joe Perches
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
There's a --strict test for these blank lines.
Add the ability to automatically remove them with --fix.
Signed-off-by: Joe Perches
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
bsd and sysv use different typedefs for unsigned types.
These are in types.h but not in checkpatch, so add them to checkpatch's
ability to know types.This can avoid false positives for code like:
void foo(void)
{
int x;
uint y;[...];
}where checkpatch incorrectly emits a warning for "missing a blank line
after declarations".Signed-off-by: Joe Perches
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
If a git commit description is split on consecutive lines, coalesce it
before testing.This allows:
commit ("some long
description")Signed-off-by: Joe Perches
Reported-by: Paul Bolle
Tested-by: Paul BolleSigned-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Add a test for probably likely/unlikely misuses where the comparison is
likely misplacedif (likely(foo) > 0)
vs
if (likely(foo > 0))Signed-off-by: Joe Perches
Cc: Christoph Jaeger
Cc: Julia Lawall
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
The git commit message can be confusing,
Try to clarify the message a bit to reduce the confusion when emitted.
Show the correct form using
Please use git commit description style 'commit ("")'
and if the git commit sha1 is unique, show
the right sha1 to use with the actual titleSigned-off-by: Joe Perches
Original-patch-by: Prarit Bhargava
Tested-by: Chris Rorvick
Acked-by: Prarit Bhargava
Cc: Daniel Baluta
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Convert all the comments to spaces before testing for single statement
macros.Reported-by: Valdis Kletnieks
Signed-off-by: Joe Perches
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Discourage the use of keyword 'boolean' for type definition attributes of
config options as support for it will be dropped later on.See http://lkml.kernel.org/r/cover.1418003065.git.cj@linux.com
Signed-off-by: Christoph Jaeger
Suggested-by: Daniel Borkmann
Cc: Joe Perches
Acked-by: Paul Bolle
Tested-by: Paul Bolle
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
KERN_ is never redundant with printk_ratelimited or printk_once.
(Except perhaps in the sense that you could use e.g. pr_err_ratelimited
or pr_err_once, but that would apply to printk as well).Signed-off-by: Paolo Bonzini
Cc: Andy Whitcroft
Acked-by: Joe Perches
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Just like "__cold", ignore the __pure gcc attribute macro so pointer
warnings aren't generated for uses like "int * __pure fn(...)"Signed-off-by: Joe Perches
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Add world writable permissions tests for the various functions like
debugfs etc...Add $String type for $FuncArg so that string constants are matched.
Signed-off-by: Joe Perches
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Since commit fe7c36c7bde1 ("Makefile: Build with -Werror=date-time if
the compiler supports it"), use of __DATE__, __TIME__, and __TIMESTAMP__
has not been allowed.As this test is gcc version specific (> 4.9), it hasn't prevented a few
new uses from creeping into the kernel sources.Make checkpatch complain about them.
Signed-off-by: Joe Perches
Original-patch-by: Rasmus VillemoesSigned-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
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 typoSigned-off-by: Joe Perches
Cc: Andy Whitcroft
Cc: Dan Carpenter
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
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 -
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 -
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 -
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