29 Oct, 2009
7 commits
-
Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Ingo reported that the following lines triggered a false warning,
static struct lock_class_key rcu_lock_key;
struct lockdep_map rcu_lock_map =
STATIC_LOCKDEP_MAP_INIT("rcu_read_lock", &rcu_lock_key);
EXPORT_SYMBOL_GPL(rcu_lock_map);from kernel/rcutree.c , and the false warning looked like this,
WARNING: EXPORT_SYMBOL(foo); should immediately follow its
function/variable
+EXPORT_SYMBOL_GPL(rcu_lock_map);We actually should be checking the statement before the EXPORT_* for a
mention of the exported object, and complain where it is not there.[akpm@linux-foundation.org: coding-style fixes]
Cc: Ingo Molnar
Cc: Paul E. McKenney
Reported-by: Daniel Walker
Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
In the following code,
union thread_union init_thread_union
__attribute__((__section__(".data.init_task"))) =
{ INIT_THREAD_INFO(init_task) };There is a non-conforming declaration. It should really be like the
following,union thread_union init_thread_union
__attribute__((__section__(".data.init_task"))) = {
INIT_THREAD_INFO(init_task)
};However, checkpatch doesn't catch this right now because it doesn't
correctly evaluate the "__attribute__".It is not at all clear that we care what preceeds an assignment style
attribute when we find the open brace. Relax the test so we do not need
to check the __attribute__.Reported-by: Daniel Walker
Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
The macro concatenation (##) sequence can cause false errors when checking
macro's. Checkpatch doesn't currently know about the operator.For example this line,
+ entry = (struct ftrace_raw_##call *)raw_data; \
is correct but it produces the following error,
ERROR: need consistent spacing around '*' (ctx:WxB)
+ entry = (struct ftrace_raw_##call *)raw_data;\
^The line above doesn't have any spacing problems, and if you remove the
macro concatenation sequence checkpatch doesn't give any errors.Extend identifier handling to include ## concatenation within the
definition of an identifier.Reported-by: Daniel Walker
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 -
We are allowing context scanning checks to apply against the first line of
context outside at the end of the hunk. This can lead to false matches to
patch names leading to various perl warnings. Correctly stop at the
bottom of the hunk.Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Prevent known non types being detected as modifiers. Ensure we do not
look at any type which starts with a keyword.Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
22 Sep, 2009
8 commits
-
Add checks for Blackfin-specific issues that seem to crop up from time to
time. In particular, we have helper macros to break a 32bit address into
the hi/lo parts, and we want to make sure people use the csync/ssync
variant that includes fun anomaly workarounds.Signed-off-by: Mike Frysinger
Signed-off-by: Bryan Wu
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 -
Limit our type matcher to the s/u/le/be etc sizes that actually exist to
prevent miss categorising s2 as a type. Fix up the spelling of the error
also.Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
We should not recommend braces for the following:
#define pr_fmt(fmt) "%s: " fmt, __func__
allow things with double quotes round them to avoid this check.
Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Impact:
- More verbose help/usage message.
- Make the option -f an alias for --file.
- On -h, --help, and --version display help message and exit(0).
- With no FILE(s) given, exit(1) with "no input files".
- On invalid options display help/usage and exit(1).Based on a patch by Pavel Machek.
Signed-off-by: Hannes Eder
Acked-by: Pavel Machek
Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Ensure we terminate when there are no futher continuation lines when
trying to determine relative indent of conditionals and their blocks.Reported-by: John Daiker
Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
This fixes the sanitation process in checkpatch.pl so that it blocks out
the text after a C99 style comment the same way it does with block style
comments. This prevents the text from getting processed as regular code.Signed-off-by: Daniel Walker
Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
An else cannot start a type, it would have to be within a block after the
else. This can trigger false modifier matching.Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
28 Feb, 2009
8 commits
-
Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Add __ref as a sparse modifier.
Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
We should allow testing of all modifiers not just attributes. Extend
testing and test for all the know modifiers.Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
We must make sure we do not misrecognise a modifier as an Identifier
when trying to match types. Prevent us matching this:void * __ref
Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
We may have any modifier following a pointer type star. Handle this:
void * __user * __user foo;
Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
We need to handle interspersed modifiers in the middle of pointer types,
for example:void * __user * __user bar;
Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
We are triggering the -p0 check for our own diffs generated using --file
command line option. Suppress this check for files.Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
We say that in_atomic() is ok in the core kernel, but then always report
it regardless of where in the kernel it is. Keep quiet if it is used in
kernel/*.Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
16 Jan, 2009
6 commits
-
Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
In the general use case struct seq_operations should be a const object.
Check for and warn where it is not.Cc: Ingo Molnar
Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
We should not be continuing a braced section with an if, for example:
if (...) {
} if (...) {
}Detect this and suggest adding a newline.
Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
When we allow return to have surrounding parentheses when containing
comparison operators we are not correctly handling the case where the
values contain array sufffixes. Squash them.Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
We should not be complaining about the prefix spacing for types and casts.
We are triggering here because the check for spacing between '*'s is
overly loose. Tighten this up.Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
If the #if opening statement is not in the context then the context stack
can be empty. Handle this by ensuring there is always a blank entry in
the stack.Signed-off-by: Andy Whitcroft
Tested-by: Dhaval Giani
Cc: Ingo Molnar
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
07 Jan, 2009
11 commits
-
Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Clean up checkpatch using perlcritic.
Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
In the general use case struct file_operations should be a const object.
Check for and warn where it is not. As suggested by Steven and Ingo.Acked-by: Steven Rostedt
Cc: Ingo Molnar
Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
When checking for assignments within if conditionals we check the whole of
the condition, but the match is performed using a line constrained regular
expression. This means we can miss split conditionals or those on the
second line. Allow the check to span lines.Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Ensure we do not report identifiers containing the word static as static
declarations. For example this should not be reported as an unecessary
assignement of 0:long nr_static = 0;
Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
When picking up a complete statement or block for analysis we cannot
simply track open/close/etc parenthesis we must take into account
preprocessor section boundaries.Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
We are miscategorising a continuation fragment following an operator
which may lead to us thinking that there is a space after it when there is
not. Fix this up.Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Loosen spacing checks to correctly detect this valid use of a typedef:
typedef struct rcu_data *(*get_data_func)(int);
Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Seems like every other release we have someone who updates vmlinux.lds.h
and adds C-visible symbols without VMLINUX_SYMBOL() around them. So start
checking the file and reject assignments which have plain symbols on
either side.[apw@canonical.com: soften the check, add tests]
Signed-off-by: Mike Frysinger
Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
It seems to be a common idiom to include braces on conditionals in all
contexts including return. Allow this exception to the return is not a
function checks. Reported by Kay Sievers.Cc: Kay Sievers
Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Some people work internally with -p0-patches which has the danger that one
forgets to convert them to -p1 before mainlining. Bitten myself and seen
p0-patches in mailing lists occasionally, this patch adds a warning to
checkpatch.pl in case a patch is -p0. If you really want, you can fool
this check to generate false positives, this is why it just spits a
warning. Making the check 100% proof is trickier than it looks, so let's
start with a version which catches the cases of real use.[apw@canonical.com: update message language, handle null prefix, add tests]
Signed-off-by: Wolfram Sang
Signed-off-by: Andy Whitcroft
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds