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 signatureSigned-off-by: Mugunthan V N
Cc: Andy Whitcroft
Cc: Joe Perches
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
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 -
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 -
Complain about files with an executable bit set that are not in a scripts/
directory and are not type .pl, .py, .awk, or .shBased 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 -
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 -
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
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) #XSigned-off-by: Joe Perches
Reported-by: Vincent Stehlé
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
28 Feb, 2013
1 commit
-
Add the ClearPage/SetPage/TestClearPage/TestSetPage variants to the not
reported Page CamelCase variables.Signed-off-by: Joe Perches
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
22 Feb, 2013
5 commits
-
Do not test udelay() for a value less than 10usec when passed a variable
instead of a hard-coded number; there is no way for checkpatch to know the
value of the variable. As it is today, it will complain about variables
with alphanumeric characters plus '_', e.g. foo_bar, but not variables
with other characters, eg. foo->bar.Signed-off-by: Bruce Allan
Cc: Andy Whitcroft
Cc: Joe Perches
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
kcalloc is sometimes misused with the first and second arguments switched.
Same issue with kmalloc_array too.
Bleat if sizeof is the first argument
Signed-off-by: Joe Perches
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
I'm getting a ton of these:
WARNING: Avoid CamelCase:
#140: FILE: mm/migrate.c:1576:
+ if (PageTransHuge(page) && page_count(page) != 3) {So exclude anything which starts with "Page".
Tested-by: Andrew Morton
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Get people to stop adding __devinit and __devexit section markings.
Signed-off-by: Joe Perches
Acked-by: Andy Whitcroft
Cc: Greg KH
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Add YA check to printk style.
dev_ uses are functions and generate smaller
object code than dev_printk(KERN_.Signed-off-by: Joe Perches
Cc: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
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
21 Dec, 2012
1 commit
-
Avoid specifying internal uapi #include paths with uapi/... as
userspace should not use and never see that.Neaten message line wrapping above.
Signed-off-by: Joe Perches
Acked-by: David Howells
Acked-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
18 Dec, 2012
12 commits
-
Store the camelcase variables in a hash and only emit a warning on the
first use of each new variable.Signed-off-by: Joe Perches
Cc: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Even though the kernel doesn't support using floating point constants,
add a regex for them.Support forms like: 0x123p1, 123e-1, 1.23, 1.5e23f
Signed-off-by: Joe Perches
Cc: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Hexadecimal values are current found in 2 parts. A hex constant like
0x123456abcdef is found as 0 and then x123456abcdef and later coalesced.Instead, reverse the order of the 2 searches in $Constant to find 0x
first, then 0 so that the entire hex constant is found all at once.Signed-off-by: Joe Perches
Cc: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
switch default case is sometimes written as "default:;". This can cause
new cases added below the default to be defective.Suggest adding a break; after empty default cases to avoid fallthrough
defects.Fixed indentation in the other semicolon test above it.
Suggested-by: Peter Senna Tschudin
Signed-off-by: Joe Perches
Cc: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
spinlock_t should always be used.
Signed-off-by: Joe Perches
Acked-by: "Luis R. Rodriguez"
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Blank lines around braces are not unnecessary. Emit a message on the use
of these blank lines only when using --strict.int foo(int bar)
{something or other....
}
is generally written in the kernel as:
int foo(int bar)
{
something or other...
}Signed-off-by: Joe Perches
Cc: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Preprocessor directives and asm statements should be allowed to have a
line continuation.Signed-off-by: Joe Perches
Tested-by: Jingoo Han
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Some projects might want a longer line length so allow a command line
--max-line-length=n control over the long line warnings. The default line
length is 80.Signed-off-by: Joe Perches
Cc: Constantine Shulyupin
Cc: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Consolidate the if (foo) bar(foo) detectors into a single check. Add
debugfs_remove and family.Based on a patch by Constantine Shulyupin.
Signed-off-by: Andy Whitcroft
Cc: Constantine Shulyupin .
Cc: Joe Perches
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
In commit 9c0ece069b32 ("Get rid of Documentation/feature-removal.txt"),
Linus removes feature-removal-schedule.txt from Documentation, but there
is still some reference to this file. So remove them.Signed-off-by: Tao Ma
Acked-by: Andy Whitcroft
Cc: Joe Perches
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
This config item has not carried much meaning for a while now and is
almost always enabled by default. As agreed during the Linux kernel
summit, it is being removed. This will discourage future addition of
CONFIG_EXPERIMENTAL while it is being phased out.Signed-off-by: Kees Cook
Cc: Andy Whitcroft
Cc: Joe Perches
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
When the previous line is not a line continuation and the current line has
a line continuation but is not a #define, emit a warning.Signed-off-by: Joe Perches
Cc: Peter Hurley
Cc: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
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
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 -
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 -
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 -
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
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
31 Jul, 2012
5 commits
-
These types of macros should not be used for either a single statement
nor should the macro end with a semi-colon.Add tests for these conditions.
Signed-off-by: Joe Perches
Cc: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Kernel style uses parenthesis around sizeof.
Signed-off-by: Joe Perches
Cc: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
usleep_range() shouldn't use the same args for min and max.
Report it when it happens and when both args are decimal and min > max.
Signed-off-by: Joe Perches
Cc: Yuval Mintz
Cc: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Warn on non-standard signature styles.
Signed-off-by: Joe Perches
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Parenthesis alignment doesn't correctly check an existing line after an
inserted or modified line with an open parenthesis.Fix it.
Signed-off-by: Joe Perches
Cc: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
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 -
Requires --strict option during invocation:
~/linux$ scripts/checkpatch --strict foo.patchThis 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