1.. SPDX-License-Identifier: GPL-2.0-only 2 3========== 4Checkpatch 5========== 6 7Checkpatch (scripts/checkpatch.pl) is a perl script which checks for trivial 8style violations in patches and optionally corrects them. Checkpatch can 9also be run on file contexts and without the kernel tree. 10 11Checkpatch is not always right. Your judgement takes precedence over checkpatch 12messages. If your code looks better with the violations, then its probably 13best left alone. 14 15 16Options 17======= 18 19This section will describe the options checkpatch can be run with. 20 21Usage:: 22 23 ./scripts/checkpatch.pl [OPTION]... [FILE]... 24 25Available options: 26 27 - -q, --quiet 28 29 Enable quiet mode. 30 31 - -v, --verbose 32 Enable verbose mode. Additional verbose test descriptions are output 33 so as to provide information on why that particular message is shown. 34 35 - --no-tree 36 37 Run checkpatch without the kernel tree. 38 39 - --no-signoff 40 41 Disable the 'Signed-off-by' line check. The sign-off is a simple line at 42 the end of the explanation for the patch, which certifies that you wrote it 43 or otherwise have the right to pass it on as an open-source patch. 44 45 Example:: 46 47 Signed-off-by: Random J Developer <[email protected]> 48 49 Setting this flag effectively stops a message for a missing signed-off-by 50 line in a patch context. 51 52 - --patch 53 54 Treat FILE as a patch. This is the default option and need not be 55 explicitly specified. 56 57 - --emacs 58 59 Set output to emacs compile window format. This allows emacs users to jump 60 from the error in the compile window directly to the offending line in the 61 patch. 62 63 - --terse 64 65 Output only one line per report. 66 67 - --showfile 68 69 Show the diffed file position instead of the input file position. 70 71 - -g, --git 72 73 Treat FILE as a single commit or a git revision range. 74 75 Single commit with: 76 77 - <rev> 78 - <rev>^ 79 - <rev>~n 80 81 Multiple commits with: 82 83 - <rev1>..<rev2> 84 - <rev1>...<rev2> 85 - <rev>-<count> 86 87 - -f, --file 88 89 Treat FILE as a regular source file. This option must be used when running 90 checkpatch on source files in the kernel. 91 92 - --subjective, --strict 93 94 Enable stricter tests in checkpatch. By default the tests emitted as CHECK 95 do not activate by default. Use this flag to activate the CHECK tests. 96 97 - --list-types 98 99 Every message emitted by checkpatch has an associated TYPE. Add this flag 100 to display all the types in checkpatch. 101 102 Note that when this flag is active, checkpatch does not read the input FILE, 103 and no message is emitted. Only a list of types in checkpatch is output. 104 105 - --types TYPE(,TYPE2...) 106 107 Only display messages with the given types. 108 109 Example:: 110 111 ./scripts/checkpatch.pl mypatch.patch --types EMAIL_SUBJECT,BRACES 112 113 - --ignore TYPE(,TYPE2...) 114 115 Checkpatch will not emit messages for the specified types. 116 117 Example:: 118 119 ./scripts/checkpatch.pl mypatch.patch --ignore EMAIL_SUBJECT,BRACES 120 121 - --show-types 122 123 By default checkpatch doesn't display the type associated with the messages. 124 Set this flag to show the message type in the output. 125 126 - --max-line-length=n 127 128 Set the max line length (default 100). If a line exceeds the specified 129 length, a LONG_LINE message is emitted. 130 131 132 The message level is different for patch and file contexts. For patches, 133 a WARNING is emitted. While a milder CHECK is emitted for files. So for 134 file contexts, the --strict flag must also be enabled. 135 136 - --min-conf-desc-length=n 137 138 Set the Kconfig entry minimum description length, if shorter, warn. 139 140 - --tab-size=n 141 142 Set the number of spaces for tab (default 8). 143 144 - --root=PATH 145 146 PATH to the kernel tree root. 147 148 This option must be specified when invoking checkpatch from outside 149 the kernel root. 150 151 - --no-summary 152 153 Suppress the per file summary. 154 155 - --mailback 156 157 Only produce a report in case of Warnings or Errors. Milder Checks are 158 excluded from this. 159 160 - --summary-file 161 162 Include the filename in summary. 163 164 - --debug KEY=[0|1] 165 166 Turn on/off debugging of KEY, where KEY is one of 'values', 'possible', 167 'type', and 'attr' (default is all off). 168 169 - --fix 170 171 This is an EXPERIMENTAL feature. If correctable errors exists, a file 172 <inputfile>.EXPERIMENTAL-checkpatch-fixes is created which has the 173 automatically fixable errors corrected. 174 175 - --fix-inplace 176 177 EXPERIMENTAL - Similar to --fix but input file is overwritten with fixes. 178 179 DO NOT USE this flag unless you are absolutely sure and you have a backup 180 in place. 181 182 - --ignore-perl-version 183 184 Override checking of perl version. Runtime errors maybe encountered after 185 enabling this flag if the perl version does not meet the minimum specified. 186 187 - --codespell 188 189 Use the codespell dictionary for checking spelling errors. 190 191 - --codespellfile 192 193 Use the specified codespell file. 194 Default is '/usr/share/codespell/dictionary.txt'. 195 196 - --typedefsfile 197 198 Read additional types from this file. 199 200 - --color[=WHEN] 201 202 Use colors 'always', 'never', or only when output is a terminal ('auto'). 203 Default is 'auto'. 204 205 - --kconfig-prefix=WORD 206 207 Use WORD as a prefix for Kconfig symbols (default is `CONFIG_`). 208 209 - -h, --help, --version 210 211 Display the help text. 212 213Message Levels 214============== 215 216Messages in checkpatch are divided into three levels. The levels of messages 217in checkpatch denote the severity of the error. They are: 218 219 - ERROR 220 221 This is the most strict level. Messages of type ERROR must be taken 222 seriously as they denote things that are very likely to be wrong. 223 224 - WARNING 225 226 This is the next stricter level. Messages of type WARNING requires a 227 more careful review. But it is milder than an ERROR. 228 229 - CHECK 230 231 This is the mildest level. These are things which may require some thought. 232 233Type Descriptions 234================= 235 236This section contains a description of all the message types in checkpatch. 237 238.. Types in this section are also parsed by checkpatch. 239.. The types are grouped into subsections based on use. 240 241 242Allocation style 243---------------- 244 245 **ALLOC_ARRAY_ARGS** 246 The first argument for kcalloc or kmalloc_array should be the 247 number of elements. sizeof() as the first argument is generally 248 wrong. 249 250 See: https://www.kernel.org/doc/html/latest/core-api/memory-allocation.html 251 252 **ALLOC_SIZEOF_STRUCT** 253 The allocation style is bad. In general for family of 254 allocation functions using sizeof() to get memory size, 255 constructs like:: 256 257 p = alloc(sizeof(struct foo), ...) 258 259 should be:: 260 261 p = alloc(sizeof(*p), ...) 262 263 See: https://www.kernel.org/doc/html/latest/process/coding-style.html#allocating-memory 264 265 **ALLOC_WITH_MULTIPLY** 266 Prefer kmalloc_array/kcalloc over kmalloc/kzalloc with a 267 sizeof multiply. 268 269 See: https://www.kernel.org/doc/html/latest/core-api/memory-allocation.html 270 271 272API usage 273--------- 274 275 **ARCH_DEFINES** 276 Architecture specific defines should be avoided wherever 277 possible. 278 279 **ARCH_INCLUDE_LINUX** 280 Whenever asm/file.h is included and linux/file.h exists, a 281 conversion can be made when linux/file.h includes asm/file.h. 282 However this is not always the case (See signal.h). 283 This message type is emitted only for includes from arch/. 284 285 **AVOID_BUG** 286 BUG() or BUG_ON() should be avoided totally. 287 Use WARN() and WARN_ON() instead, and handle the "impossible" 288 error condition as gracefully as possible. 289 290 See: https://www.kernel.org/doc/html/latest/process/deprecated.html#bug-and-bug-on 291 292 **CONSIDER_KSTRTO** 293 The simple_strtol(), simple_strtoll(), simple_strtoul(), and 294 simple_strtoull() functions explicitly ignore overflows, which 295 may lead to unexpected results in callers. The respective kstrtol(), 296 kstrtoll(), kstrtoul(), and kstrtoull() functions tend to be the 297 correct replacements. 298 299 See: https://www.kernel.org/doc/html/latest/process/deprecated.html#simple-strtol-simple-strtoll-simple-strtoul-simple-strtoull 300 301 **IN_ATOMIC** 302 in_atomic() is not for driver use so any such use is reported as an ERROR. 303 Also in_atomic() is often used to determine if we may sleep, but it is not 304 reliable in this use model therefore its use is strongly discouraged. 305 306 However, in_atomic() is ok for core kernel use. 307 308 See: https://lore.kernel.org/lkml/[email protected]/ 309 310 **LOCKDEP** 311 The lockdep_no_validate class was added as a temporary measure to 312 prevent warnings on conversion of device->sem to device->mutex. 313 It should not be used for any other purpose. 314 315 See: https://lore.kernel.org/lkml/1268959062.9440.467.camel@laptop/ 316 317 **MALFORMED_INCLUDE** 318 The #include statement has a malformed path. This has happened 319 because the author has included a double slash "//" in the pathname 320 accidentally. 321 322 **USE_LOCKDEP** 323 lockdep_assert_held() annotations should be preferred over 324 assertions based on spin_is_locked() 325 326 See: https://www.kernel.org/doc/html/latest/locking/lockdep-design.html#annotations 327 328 **UAPI_INCLUDE** 329 No #include statements in include/uapi should use a uapi/ path. 330 331 **USLEEP_RANGE** 332 usleep_range() should be preferred over udelay(). The proper way of 333 using usleep_range() is mentioned in the kernel docs. 334 335 See: https://www.kernel.org/doc/html/latest/timers/timers-howto.html#delays-information-on-the-various-kernel-delay-sleep-mechanisms 336 337 338Comment style 339------------- 340 341 **BLOCK_COMMENT_STYLE** 342 The comment style is incorrect. The preferred style for multi- 343 line comments is:: 344 345 /* 346 * This is the preferred style 347 * for multi line comments. 348 */ 349 350 The networking comment style is a bit different, with the first line 351 not empty like the former:: 352 353 /* This is the preferred comment style 354 * for files in net/ and drivers/net/ 355 */ 356 357 See: https://www.kernel.org/doc/html/latest/process/coding-style.html#commenting 358 359 **C99_COMMENTS** 360 C99 style single line comments (//) should not be used. 361 Prefer the block comment style instead. 362 363 See: https://www.kernel.org/doc/html/latest/process/coding-style.html#commenting 364 365 366Commit message 367-------------- 368 369 **BAD_SIGN_OFF** 370 The signed-off-by line does not fall in line with the standards 371 specified by the community. 372 373 See: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#developer-s-certificate-of-origin-1-1 374 375 **BAD_STABLE_ADDRESS_STYLE** 376 The email format for stable is incorrect. 377 Some valid options for stable address are:: 378 379 1. [email protected] 380 2. [email protected] 381 382 For adding version info, the following comment style should be used:: 383 384 [email protected] # version info 385 386 **COMMIT_COMMENT_SYMBOL** 387 Commit log lines starting with a '#' are ignored by git as 388 comments. To solve this problem addition of a single space 389 infront of the log line is enough. 390 391 **COMMIT_MESSAGE** 392 The patch is missing a commit description. A brief 393 description of the changes made by the patch should be added. 394 395 See: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#describe-your-changes 396 397 **FROM_SIGN_OFF_MISMATCH** 398 The author's email does not match with that in the Signed-off-by: 399 line(s). This can be sometimes caused due to an improperly configured 400 email client. 401 402 This message is emitted due to any of the following reasons:: 403 404 - The email names do not match. 405 - The email addresses do not match. 406 - The email subaddresses do not match. 407 - The email comments do not match. 408 409 **MISSING_SIGN_OFF** 410 The patch is missing a Signed-off-by line. A signed-off-by 411 line should be added according to Developer's certificate of 412 Origin. 413 414 See: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#sign-your-work-the-developer-s-certificate-of-origin 415 416 **NO_AUTHOR_SIGN_OFF** 417 The author of the patch has not signed off the patch. It is 418 required that a simple sign off line should be present at the 419 end of explanation of the patch to denote that the author has 420 written it or otherwise has the rights to pass it on as an open 421 source patch. 422 423 See: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#sign-your-work-the-developer-s-certificate-of-origin 424 425 **DIFF_IN_COMMIT_MSG** 426 Avoid having diff content in commit message. 427 This causes problems when one tries to apply a file containing both 428 the changelog and the diff because patch(1) tries to apply the diff 429 which it found in the changelog. 430 431 See: https://lore.kernel.org/lkml/[email protected]/ 432 433 **GERRIT_CHANGE_ID** 434 To be picked up by gerrit, the footer of the commit message might 435 have a Change-Id like:: 436 437 Change-Id: Ic8aaa0728a43936cd4c6e1ed590e01ba8f0fbf5b 438 Signed-off-by: A. U. Thor <[email protected]> 439 440 The Change-Id line must be removed before submitting. 441 442 **GIT_COMMIT_ID** 443 The proper way to reference a commit id is: 444 commit <12+ chars of sha1> ("<title line>") 445 446 An example may be:: 447 448 Commit e21d2170f36602ae2708 ("video: remove unnecessary 449 platform_set_drvdata()") removed the unnecessary 450 platform_set_drvdata(), but left the variable "dev" unused, 451 delete it. 452 453 See: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#describe-your-changes 454 455 456Comparison style 457---------------- 458 459 **ASSIGN_IN_IF** 460 Do not use assignments in if condition. 461 Example:: 462 463 if ((foo = bar(...)) < BAZ) { 464 465 should be written as:: 466 467 foo = bar(...); 468 if (foo < BAZ) { 469 470 **BOOL_COMPARISON** 471 Comparisons of A to true and false are better written 472 as A and !A. 473 474 See: https://lore.kernel.org/lkml/1365563834.27174.12.camel@joe-AO722/ 475 476 **COMPARISON_TO_NULL** 477 Comparisons to NULL in the form (foo == NULL) or (foo != NULL) 478 are better written as (!foo) and (foo). 479 480 **CONSTANT_COMPARISON** 481 Comparisons with a constant or upper case identifier on the left 482 side of the test should be avoided. 483 484 485Macros, Attributes and Symbols 486------------------------------ 487 488 **ARRAY_SIZE** 489 The ARRAY_SIZE(foo) macro should be preferred over 490 sizeof(foo)/sizeof(foo[0]) for finding number of elements in an 491 array. 492 493 The macro is defined in include/linux/kernel.h:: 494 495 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) 496 497 **AVOID_EXTERNS** 498 Function prototypes don't need to be declared extern in .h 499 files. It's assumed by the compiler and is unnecessary. 500 501 **AVOID_L_PREFIX** 502 Local symbol names that are prefixed with `.L` should be avoided, 503 as this has special meaning for the assembler; a symbol entry will 504 not be emitted into the symbol table. This can prevent `objtool` 505 from generating correct unwind info. 506 507 Symbols with STB_LOCAL binding may still be used, and `.L` prefixed 508 local symbol names are still generally usable within a function, 509 but `.L` prefixed local symbol names should not be used to denote 510 the beginning or end of code regions via 511 `SYM_CODE_START_LOCAL`/`SYM_CODE_END` 512 513 **BIT_MACRO** 514 Defines like: 1 << <digit> could be BIT(digit). 515 The BIT() macro is defined via include/linux/bits.h:: 516 517 #define BIT(nr) (1UL << (nr)) 518 519 **CONST_READ_MOSTLY** 520 When a variable is tagged with the __read_mostly annotation, it is a 521 signal to the compiler that accesses to the variable will be mostly 522 reads and rarely(but NOT never) a write. 523 524 const __read_mostly does not make any sense as const data is already 525 read-only. The __read_mostly annotation thus should be removed. 526 527 **DATE_TIME** 528 It is generally desirable that building the same source code with 529 the same set of tools is reproducible, i.e. the output is always 530 exactly the same. 531 532 The kernel does *not* use the ``__DATE__`` and ``__TIME__`` macros, 533 and enables warnings if they are used as they can lead to 534 non-deterministic builds. 535 536 See: https://www.kernel.org/doc/html/latest/kbuild/reproducible-builds.html#timestamps 537 538 **DEFINE_ARCH_HAS** 539 The ARCH_HAS_xyz and ARCH_HAVE_xyz patterns are wrong. 540 541 For big conceptual features use Kconfig symbols instead. And for 542 smaller things where we have compatibility fallback functions but 543 want architectures able to override them with optimized ones, we 544 should either use weak functions (appropriate for some cases), or 545 the symbol that protects them should be the same symbol we use. 546 547 See: https://lore.kernel.org/lkml/CA+55aFycQ9XJvEOsiM3txHL5bjUc8CeKWJNR_H+MiicaddB42Q@mail.gmail.com/ 548 549 **INIT_ATTRIBUTE** 550 Const init definitions should use __initconst instead of 551 __initdata. 552 553 Similarly init definitions without const require a separate 554 use of const. 555 556 **INLINE_LOCATION** 557 The inline keyword should sit between storage class and type. 558 559 For example, the following segment:: 560 561 inline static int example_function(void) 562 { 563 ... 564 } 565 566 should be:: 567 568 static inline int example_function(void) 569 { 570 ... 571 } 572 573 **MISPLACED_INIT** 574 It is possible to use section markers on variables in a way 575 which gcc doesn't understand (or at least not the way the 576 developer intended):: 577 578 static struct __initdata samsung_pll_clock exynos4_plls[nr_plls] = { 579 580 does not put exynos4_plls in the .initdata section. The __initdata 581 marker can be virtually anywhere on the line, except right after 582 "struct". The preferred location is before the "=" sign if there is 583 one, or before the trailing ";" otherwise. 584 585 See: https://lore.kernel.org/lkml/1377655732.3619.19.camel@joe-AO722/ 586 587 **MULTISTATEMENT_MACRO_USE_DO_WHILE** 588 Macros with multiple statements should be enclosed in a 589 do - while block. Same should also be the case for macros 590 starting with `if` to avoid logic defects:: 591 592 #define macrofun(a, b, c) \ 593 do { \ 594 if (a == 5) \ 595 do_this(b, c); \ 596 } while (0) 597 598 See: https://www.kernel.org/doc/html/latest/process/coding-style.html#macros-enums-and-rtl 599 600 **PREFER_FALLTHROUGH** 601 Use the `fallthrough;` pseudo keyword instead of 602 `/* fallthrough */` like comments. 603 604 **WEAK_DECLARATION** 605 Using weak declarations like __attribute__((weak)) or __weak 606 can have unintended link defects. Avoid using them. 607 608 609Functions and Variables 610----------------------- 611 612 **CAMELCASE** 613 Avoid CamelCase Identifiers. 614 615 See: https://www.kernel.org/doc/html/latest/process/coding-style.html#naming 616 617 **FUNCTION_WITHOUT_ARGS** 618 Function declarations without arguments like:: 619 620 int foo() 621 622 should be:: 623 624 int foo(void) 625 626 **GLOBAL_INITIALISERS** 627 Global variables should not be initialized explicitly to 628 0 (or NULL, false, etc.). Your compiler (or rather your 629 loader, which is responsible for zeroing out the relevant 630 sections) automatically does it for you. 631 632 **INITIALISED_STATIC** 633 Static variables should not be initialized explicitly to zero. 634 Your compiler (or rather your loader) automatically does 635 it for you. 636 637 **RETURN_PARENTHESES** 638 return is not a function and as such doesn't need parentheses:: 639 640 return (bar); 641 642 can simply be:: 643 644 return bar; 645 646 647Permissions 648----------- 649 650 **EXECUTE_PERMISSIONS** 651 There is no reason for source files to be executable. The executable 652 bit can be removed safely. 653 654 **EXPORTED_WORLD_WRITABLE** 655 Exporting world writable sysfs/debugfs files is usually a bad thing. 656 When done arbitrarily they can introduce serious security bugs. 657 In the past, some of the debugfs vulnerabilities would seemingly allow 658 any local user to write arbitrary values into device registers - a 659 situation from which little good can be expected to emerge. 660 661 See: https://lore.kernel.org/linux-arm-kernel/[email protected]/ 662 663 **NON_OCTAL_PERMISSIONS** 664 Permission bits should use 4 digit octal permissions (like 0700 or 0444). 665 Avoid using any other base like decimal. 666 667 668Spacing and Brackets 669-------------------- 670 671 **ASSIGNMENT_CONTINUATIONS** 672 Assignment operators should not be written at the start of a 673 line but should follow the operand at the previous line. 674 675 **BRACES** 676 The placement of braces is stylistically incorrect. 677 The preferred way is to put the opening brace last on the line, 678 and put the closing brace first:: 679 680 if (x is true) { 681 we do y 682 } 683 684 This applies for all non-functional blocks. 685 However, there is one special case, namely functions: they have the 686 opening brace at the beginning of the next line, thus:: 687 688 int function(int x) 689 { 690 body of function 691 } 692 693 See: https://www.kernel.org/doc/html/latest/process/coding-style.html#placing-braces-and-spaces 694 695 **BRACKET_SPACE** 696 Whitespace before opening bracket '[' is prohibited. 697 There are some exceptions: 698 699 1. With a type on the left:: 700 701 int [] a; 702 703 2. At the beginning of a line for slice initialisers:: 704 705 [0...10] = 5, 706 707 3. Inside a curly brace:: 708 709 = { [0...10] = 5 } 710 711 **CODE_INDENT** 712 Code indent should use tabs instead of spaces. 713 Outside of comments, documentation and Kconfig, 714 spaces are never used for indentation. 715 716 See: https://www.kernel.org/doc/html/latest/process/coding-style.html#indentation 717 718 **CONCATENATED_STRING** 719 Concatenated elements should have a space in between. 720 Example:: 721 722 printk(KERN_INFO"bar"); 723 724 should be:: 725 726 printk(KERN_INFO "bar"); 727 728 **ELSE_AFTER_BRACE** 729 `else {` should follow the closing block `}` on the same line. 730 731 See: https://www.kernel.org/doc/html/latest/process/coding-style.html#placing-braces-and-spaces 732 733 **LINE_SPACING** 734 Vertical space is wasted given the limited number of lines an 735 editor window can display when multiple blank lines are used. 736 737 See: https://www.kernel.org/doc/html/latest/process/coding-style.html#spaces 738 739 **OPEN_BRACE** 740 The opening brace should be following the function definitions on the 741 next line. For any non-functional block it should be on the same line 742 as the last construct. 743 744 See: https://www.kernel.org/doc/html/latest/process/coding-style.html#placing-braces-and-spaces 745 746 **POINTER_LOCATION** 747 When using pointer data or a function that returns a pointer type, 748 the preferred use of * is adjacent to the data name or function name 749 and not adjacent to the type name. 750 Examples:: 751 752 char *linux_banner; 753 unsigned long long memparse(char *ptr, char **retptr); 754 char *match_strdup(substring_t *s); 755 756 See: https://www.kernel.org/doc/html/latest/process/coding-style.html#spaces 757 758 **SPACING** 759 Whitespace style used in the kernel sources is described in kernel docs. 760 761 See: https://www.kernel.org/doc/html/latest/process/coding-style.html#spaces 762 763 **SWITCH_CASE_INDENT_LEVEL** 764 switch should be at the same indent as case. 765 Example:: 766 767 switch (suffix) { 768 case 'G': 769 case 'g': 770 mem <<= 30; 771 break; 772 case 'M': 773 case 'm': 774 mem <<= 20; 775 break; 776 case 'K': 777 case 'k': 778 mem <<= 10; 779 /* fall through */ 780 default: 781 break; 782 } 783 784 See: https://www.kernel.org/doc/html/latest/process/coding-style.html#indentation 785 786 **TRAILING_WHITESPACE** 787 Trailing whitespace should always be removed. 788 Some editors highlight the trailing whitespace and cause visual 789 distractions when editing files. 790 791 See: https://www.kernel.org/doc/html/latest/process/coding-style.html#spaces 792 793 **UNNECESSARY_PARENTHESES** 794 Parentheses are not required in the following cases:: 795 796 1. Function pointer uses:: 797 798 (foo->bar)(); 799 800 could be:: 801 802 foo->bar(); 803 804 2. Comparisons in if:: 805 806 if ((foo->bar) && (foo->baz)) 807 if ((foo == bar)) 808 809 could be:: 810 811 if (foo->bar && foo->baz) 812 if (foo == bar) 813 814 3. addressof/dereference single Lvalues:: 815 816 &(foo->bar) 817 *(foo->bar) 818 819 could be:: 820 821 &foo->bar 822 *foo->bar 823 824 **WHILE_AFTER_BRACE** 825 while should follow the closing bracket on the same line:: 826 827 do { 828 ... 829 } while(something); 830 831 See: https://www.kernel.org/doc/html/latest/process/coding-style.html#placing-braces-and-spaces 832 833 834Others 835------ 836 837 **CONFIG_DESCRIPTION** 838 Kconfig symbols should have a help text which fully describes 839 it. 840 841 **CORRUPTED_PATCH** 842 The patch seems to be corrupted or lines are wrapped. 843 Please regenerate the patch file before sending it to the maintainer. 844 845 **DOS_LINE_ENDINGS** 846 For DOS-formatted patches, there are extra ^M symbols at the end of 847 the line. These should be removed. 848 849 **FSF_MAILING_ADDRESS** 850 Kernel maintainers reject new instances of the GPL boilerplate paragraph 851 directing people to write to the FSF for a copy of the GPL, since the 852 FSF has moved in the past and may do so again. 853 So do not write paragraphs about writing to the Free Software Foundation's 854 mailing address. 855 856 See: https://lore.kernel.org/lkml/20131006222342.GT19510@leaf/ 857 858 **LONG_LINE** 859 The line has exceeded the specified maximum length. Consider refactoring 860 it. 861 To use a different maximum line length, the --max-line-length=n option 862 may be added while invoking checkpatch. 863 864 See: https://www.kernel.org/doc/html/latest/process/coding-style.html#breaking-long-lines-and-strings 865 866 **LONG_LINE_STRING** 867 A string starts before but extends beyond the maximum line length. 868 To use a different maximum line length, the --max-line-length=n option 869 may be added while invoking checkpatch. 870 871 See: https://www.kernel.org/doc/html/latest/process/coding-style.html#breaking-long-lines-and-strings 872 873 **LONG_LINE_COMMENT** 874 A comment starts before but extends beyond the maximum line length. 875 To use a different maximum line length, the --max-line-length=n option 876 may be added while invoking checkpatch. 877 878 See: https://www.kernel.org/doc/html/latest/process/coding-style.html#breaking-long-lines-and-strings 879 880 **MEMSET** 881 The memset use appears to be incorrect. This may be caused due to 882 badly ordered parameters. Please recheck the usage. 883 884 **NOT_UNIFIED_DIFF** 885 The patch file does not appear to be in unified-diff format. Please 886 regenerate the patch file before sending it to the maintainer. 887 888 **PRINTF_0XDECIMAL** 889 Prefixing 0x with decimal output is defective and should be corrected. 890 891 **SPDX_LICENSE_TAG** 892 The source file is missing or has an improper SPDX identifier tag. 893 The Linux kernel requires the precise SPDX identifier in all source files, 894 and it is thoroughly documented in the kernel docs. 895 896 See: https://www.kernel.org/doc/html/latest/process/license-rules.html 897 898 **TRAILING_STATEMENTS** 899 Trailing statements (for example after any conditional) should be 900 on the next line. 901 Like:: 902 903 if (x == y) break; 904 905 should be:: 906 907 if (x == y) 908 break; 909 910 **TYPO_SPELLING** 911 Some words may have been misspelled. Consider reviewing them. 912