Commit 91c9afaf authored by Andy Lutomirski's avatar Andy Lutomirski Committed by Linus Torvalds

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: default avatarAndy 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: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent c17893c7
...@@ -3396,6 +3396,14 @@ sub process { ...@@ -3396,6 +3396,14 @@ sub process {
"Prefer dev_$level(... to dev_printk(KERN_$orig, ...\n" . $herecurr); "Prefer dev_$level(... to dev_printk(KERN_$orig, ...\n" . $herecurr);
} }
# ENOSYS means "bad syscall nr" and nothing else. This will have a small
# number of false positives, but assembly files are not checked, so at
# least the arch entry code will not trigger this warning.
if ($line =~ /\bENOSYS\b/) {
WARN("ENOSYS",
"ENOSYS means 'invalid syscall nr' and nothing else\n" . $herecurr);
}
# function brace can't be on same line, except for #defines of do while, # function brace can't be on same line, except for #defines of do while,
# or if closed on same line # or if closed on same line
if (($line=~/$Type\s*$Ident\(.*\).*\s*{/) and if (($line=~/$Type\s*$Ident\(.*\).*\s*{/) and
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment