Commit 91c9afaf97ee554d2cd3042a5ad01ad21c99e8c4
Committed by
Linus Torvalds
1 parent
c17893c740
Exists in
ti-lsk-linux-4.1.y
and in
10 other branches
checkpatch.pl: new instances of ENOSYS are errors
ENOSYS means that a nonexistent system call was called. We have a bad habit of using it for things like invalid operations on otherwise valid syscalls. We should avoid this in new code. Pervasive incorrect usage of ENOSYS came up at the kernel summit ABI review discussion. Let's see if checkpatch can help. I'll submit a separate patch for include/uapi/asm-generic/errno.h. Signed-off-by: Andy Lutomirski <luto@amacapital.net> Cc: Pavel Machek <pavel@ucw.cz> Cc: Michael Kerrisk <mtk.manpages@gmail.com> Cc: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 1 changed file with 8 additions and 0 deletions Side-by-side Diff
scripts/checkpatch.pl
... | ... | @@ -3396,6 +3396,14 @@ |
3396 | 3396 | "Prefer dev_$level(... to dev_printk(KERN_$orig, ...\n" . $herecurr); |
3397 | 3397 | } |
3398 | 3398 | |
3399 | +# ENOSYS means "bad syscall nr" and nothing else. This will have a small | |
3400 | +# number of false positives, but assembly files are not checked, so at | |
3401 | +# least the arch entry code will not trigger this warning. | |
3402 | + if ($line =~ /\bENOSYS\b/) { | |
3403 | + WARN("ENOSYS", | |
3404 | + "ENOSYS means 'invalid syscall nr' and nothing else\n" . $herecurr); | |
3405 | + } | |
3406 | + | |
3399 | 3407 | # function brace can't be on same line, except for #defines of do while, |
3400 | 3408 | # or if closed on same line |
3401 | 3409 | if (($line=~/$Type\s*$Ident\(.*\).*\s*{/) and |