25 May, 2011
3 commits
-
Currently, printk lines with a only KERN_PREFIX and a quoted string
without a comma or close paren that exceed 80 columns are flagged with a
warning.ie:
printk(KERN_WARNING "some long string that extends beond 80 cols..."
"and is continued on another line\n");Allow this form instead of emitting a warning.
Signed-off-by: Joe Perches
Cc: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Many module or file local logging functions use specific prefixes other
than pr|dev|netdev. Allow all forms like foo_printk and foo_err to be
longer than 80 columns.Also allow MODULE_ declarations to be longer than 80 columns.
Signed-off-by: Joe Perches
Cc: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Add a warning for unterminated quoted strings with line continuations as
these frequently add unwanted whitespace.Signed-off-by: Joe Perches
Cc: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
31 Mar, 2011
1 commit
-
Fixes generated by 'codespell' and manually reviewed.
Signed-off-by: Lucas De Marchi
23 Mar, 2011
3 commits
-
Because the second and third arguments of memset have the same type, it
turns out to be really easy to mix them up.This bug comes up time after time, so checkpatch should really be checking
for it at patch submission time.Signed-off-by: Dave Jones
Cc: Steven Rostedt
Cc: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
If you run checkpatch against multiple patches, and one of them has a
whitespace issue which can be helped via a script (rpt_cleaners), you will
see the same NOTE over and over for all subsequent patches. It makes it
seem like those patches also have whitespace problems when in reality,
there's only one or two bad apples.So reset rpt_cleaners back to 0 after we've issued the note so that it
only shows up near the patch with the actual problems.Signed-off-by: Mike Frysinger
Cc: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
1. simple_strto*() do not contain overflow checks and crufty,
libc way to indicate failure.
2. strict_strto*() also do not have overflow checks but the name and
comments pretend they do.
3. Both families have only "long long" and "long" variants,
but users want strtou8()
4. Both "simple" and "strict" prefixes are wrong:
Simple doesn't exactly say what's so simple, strict should not exist
because conversion should be strict by default.The solution is to use "k" prefix and add convertors for more types.
Enter
kstrtoull()
kstrtoll()
kstrtoul()
kstrtol()
kstrtouint()
kstrtoint()kstrtou64()
kstrtos64()
kstrtou32()
kstrtos32()
kstrtou16()
kstrtos16()
kstrtou8()
kstrtos8()Include runtime testsuite (somewhat incomplete) as well.
strict_strto*() become deprecated, stubbed to kstrto*() and
eventually will be removed altogether.Use kstrto*() in code today!
Note: on some archs _kstrtoul() and _kstrtol() are left in tree, even if
they'll be unused at runtime. This is temporarily solution,
because I don't want to hardcode list of archs where these
functions aren't needed. Current solution with sizeof() and
__alignof__ at least always works.Signed-off-by: Alexey Dobriyan
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
27 Jan, 2011
1 commit
-
Last users are gone. Remove the left overs.
Signed-off-by: Thomas Gleixner
14 Jan, 2011
4 commits
-
There's a __packed #define for __attribute__((packed)). Add a checkpatch
to tell people about it.Signed-off-by: Joe Perches
Cc: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Exporting world writable sysfs/debugfs files is usually a bad thing. Warn
about it.Signed-off-by: Dave Jones
Cc: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
We should only claim that something is a cast if we did not encouter a
token before, that did set av_pending.This fixes the operator * in the line below to be detected as binary (vs
unary).kmalloc(sizeof(struct alphatrack_ocmd) * true_size, GFP_KERNEL);
Reported-by: Audun Hoem
Signed-off-by: Florian Mickler
Cc: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Signed-off-by: Joe Perches
Cc: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
30 Oct, 2010
1 commit
-
Semaphores used as mutexes have been deprecated for years. Now that
all users are either converted to real semaphores or to mutexes remove
the cruft.Signed-off-by: Thomas Gleixner
Cc: Peter Zijlstra
Cc: Christoph Hellwig
LKML-Reference:
27 Oct, 2010
18 commits
-
Signed-off-by: Joe Perches
Cc: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Add warnings for possible missing const uses of
static char foo[] = "bar"
that could be
static const char foo[] = "bar"
and
static const char *foo[] = {"bar", "baz"}
that could be
static const char * const foo[] = {"bar", "baz"}Signed-off-by: Joe Perches
Cc: Mike Frysinger
Cc: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
When tracking context to find a block or statement we need to use the
sanitised lines, else perentheses '(' & ')' and braces '{' & '}' can throw
the scanner out. Also fix up a couple of error outputs which include
those sanitised lines incorrectly.Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Handly definitions similar to below. The definition macro spits out a
symbol with a prefix. Add matching of any identifier prefix:DEVICE_ATTR(link_power_management_policy, S_IRUGO | S_IWUSR,
ata_scsi_lpm_show, ata_scsi_lpm_put);
EXPORT_SYMBOL_GPL(dev_attr_link_power_management_policy);Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Handle definitions such as the following correctly, it is not
a complex statement:#define PREALLOC(NAME, START, END, FLAGS) { \
.name = (NAME), \
.start = (START), \
.end = (END), \
.flags = (FLAGS) \
},Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
On Wed, 2010-08-11 at 12:35 -0400, Dave Jones wrote:
> I just got this from a patch I merged..
>
> ERROR: need consistent spacing around '*' (ctx:WxV)
> #121: FILE: arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c:113:
> +static struct pcc_cpu __percpu *pcc_cpu_info;
> ^
> which doesn't seem right.Perhaps these need to be added to checkpatch.
[apw@canonical.com: added tests]
Signed-off-by: Joe Perches
Signed-off-by: Andy Whitcroft
Cc: Dave Jones
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Throw an error when a source file has been given execute permissions using
the mode change line present in git diffs. Also alow the filename
matching to use the "diff" line in addition to the "+++" line, since the
mode change lines appear before any "+++" lines.[apw@canonical.com: simplified filename logic slightly, added tests]
Cc: Andy Whitcroft
Acked-by: Linus Walleij
Signed-off-by: Rabin Vincent
Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
When checking the length of the help we need to be sure we are seeing the
whole story before erroring. Firstly we only want to check when adding
the help in the first place. Second we need to be sure that we are seeing
the end of the entry, nominally when there is no context below or that
context shows the start of the next entry.Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Commonise the code for missing spaces after struct, union, and enum such
that they share the same code. Ensure we cover all the common cases in
each case. Check against the sanitised line to ensure we do not report on
comments and strings.Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Add spacing checks for struct, union, and enum definitions. Check the
spacing after type and before the equals (=) and open brace ({).Based on a patch by Joe Perches.
Cc: Joe Perches
Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Add a (strict mode only) test to check for non-negative returns of what
appear to be errno values as the majority case these should indeed be
negative.Suggested-by: Andrew Morton
Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
The following incantation is triggering categorisation of its colon (:) as
a binary form, which it is not:return foo ? (s8)bar : baz;
Handle casts differently from types in the categoriser, allowing us to
better track (s8)bar as a value and not a declaration.Reported-by: Jean Delvare
Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
When determining if a return () sequence is a function style bracketing we
simplify the expression one bracket at a time replacing each with a
constant. However this can trigger a false merge with expressions as
below:return (foo)0;
Prevent this false merging.
Reported-by: Hitoshi Mitake
Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
When we hit types of whitespace which may be fixed by scripts/cleanpatch
and scripts/cleanfile suggest their use in our report.Suggested-by: Bartlomiej Zolnierkiewicz
Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
When the following form is used we have a type which fully fills a line.
This means that a type may end at the end of line as well as at the
following identifier.int **
foo;Reported-by: Daniel Walker
Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
The patch "checkpatch: fix handling of leading spaces" added checks for
leading spaces on lines, but this introduces regressions. Firstly it does
not correctly detect when we are in a comment. Secondly it does not allow
for preprocessor command spacing. Finally it does not allow for label
indentation which is required to be less than one tab. Fix these up:Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
10 Aug, 2010
7 commits
-
These are caused by checkpatch incorrectly parsing its internal
representation of a statement block for struct's (or anything else that is
a statement block encapsulated in {}'s that also ends with a ';'). Fix
this by properly parsing a statement block.An example:
+struct dummy_type dummy = {
+ .foo = "baz",
+};
+EXPORT_SYMBOL_GPL(dummy);
+
+static int dummy_func(void)
+{
+ return -EDUMMYCODE;
+}
+EXPORT_SYMBOL_GPL(dummy_func);WARNING: EXPORT_SYMBOL(foo); should immediately \
follow its function/variable
#19: FILE: dummy.c:4:
+EXPORT_SYMBOL_GPL(dummy);The above warning is issued when it should not be.
Signed-off-by: Patrick Pannuto
Cc: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
As explained in Documentation/timers/timers-howto.txt, msleep's of < 20ms
may sleep for as long as 20ms. Caller's of msleep(1) or msleep(2), etc
are likely not to expect this quirky behavior - warn them.Signed-off-by: Patrick Pannuto
Cc: Thomas Gleixner
Cc: Ingo Molnar
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
When possible, sleeping is (usually) better than delaying; however, don't
bother callers of udelay < 10us, as those cases are generally not worth
the switch to usleep[akpm@linux-foundation.org: fix mismatched parentheses]
Signed-off-by: Patrick Pannuto
Cc: Thomas Gleixner
Cc: Ingo Molnar
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Add new logging functions netdev_ and netif_.
Don't complain if the only thing on a line is a quoted string.Signed-off-by: Joe Perches
Cc: Andy Whitcroft
Cc: Wolfram Sang
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Make error message say 'ERROR: do not initialise globals to 0 or NULL'
rather than 'ERROR: do not initialise externals to 0 or NULL'. Makes more
sense in the context since there is an extern keyword in C and that is a
global declaration within the scope of the current file.Signed-off-by: Joe Eloff
Cc: Andy Whitcroft
Cc: Wolfram Sang
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
I've got a false positive when spaces are present at the beginning of a
line.So I add this check, obviously excluding to check the lines in the middle of
comments.For instance this code passes the checkpatch test:
+struct davinci_mcbsp_data {
+ unsigned int fmt;
+ int clk_div;
+};
+
+static struct davinci_mcbsp_data mcbsp_data;Where, before the string "int clk_div", I have 4 spaces (\040
ascii character).With v2.6.34 scripts/checkpatch.pl script I get:
scripts/checkpatch.pl 0001-ASoC-DaVinci-Added-support-for-stereo-I2S.patch
total: 0 errors, 0 warnings, 201 lines checked
0001-ASoC-DaVinci-Added-support-for-stereo-I2S.patch has no obvious style
problems and is ready for submission.That is not correct. Instead with the proposed patch I get:
scripts/checkpatch.pl 0001-ASoC-DaVinci-Added-support-for-stereo-I2S.patch
WARNING: please, no space for starting a line,
excluding comments
#63: FILE: sound/soc/davinci/davinci-i2s.c:165:
+ int clk_div;$WARNING: please, no space for starting a line,
excluding comments
#95: FILE: sound/soc/davinci/davinci-i2s.c:406:
+ return 0;$total: 0 errors, 2 warnings, 201 lines checked
That is correct.
Signed-off-by: Raffaele Recalcati
Cc: Wolfram Sang
Cc: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Change the check suggesting replacement of asm-includes with
linux-includes. Exceptions to this rule are easier to extend now. Add
memory.h because ARM has a custom one.Signed-off-by: Wolfram Sang
Cc: Russell King
Cc: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
25 May, 2010
2 commits
-
The C99 specification states in section 6.11.5:
The placement of a storage-class specifier other than at the beginning
of the declaration specifiers in a declaration is an obsolescent
feature.Signed-off-by: Tobias Klauser
Acked-by: Jean Delvare
Cc: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
I've seen various new Kconfigs with rather unhelpful one liner
descriptions. Add a Kconfig warning for a minimum length of the Kconfig
help section.Right now I arbitarily chose 4. The exact value can be debated.
[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Andi Kleen
Cc: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds