lkml.org 
[lkml]   [2021]   [Feb]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v5 0/2] checkpatch: add verbose mode
From
Date
On Sat, 2021-02-20 at 17:32 +0530, Dwaipayan Ray wrote:
> Add a new verbose mode to checkpatch. The verbose test
> descriptions are read from the checkpatch documentation
> file at `Documentation/dev-tools/checkpatch.rst`.
>
> The verbose mode is optional and can be enabled by the
> flag -v or --verbose.
>
> The documentation file is only parsed by checkpatch.pl
> if the verbose mode is enabled. The verbose mode can
> not be used together with the --terse option.
>
> Changes in v5:
> - Change the reference format to use absolute links.
> - Print verbose descriptions only for the first time
>   a message type is encountered.

OK, I think a nice addition would be to add --verbose
text to the --list-types option when used together.

$ ./scripts/checkpatch.pl --list-types --verbose
1 ALLOC_ARRAY_ARGS

The first argument for kcalloc or kmalloc_array should be the
number of elements. sizeof() as the first argument is generally
wrong.

See: https://www.kernel.org/doc/html/latest/core-api/memory-allocation.html

2 ALLOC_SIZEOF_STRUCT

The allocation style is bad. In general for family of
allocation functions using sizeof() to get memory size,
constructs like::

p = alloc(sizeof(struct foo), ...)

should be::

p = alloc(sizeof(*p), ...)

See: https://www.kernel.org/doc/html/latest/process/coding-style.html#allocating-memory

etc...


\
 
 \ /
  Last update: 2021-02-20 16:17    [W:0.043 / U:1.964 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site