From: Andy Lutomirski Date: Thu, 16 Apr 2015 19:44:44 +0000 (-0700) Subject: checkpatch.pl: new instances of ENOSYS are errors X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=91c9afaf97ee554d2cd3042a5ad01ad21c99e8c4;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Cc: Pavel Machek Cc: Michael Kerrisk Cc: Joe Perches Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 28516587baba..561f41ef531f 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -3396,6 +3396,14 @@ sub process { "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, # or if closed on same line if (($line=~/$Type\s*$Ident\(.*\).*\s*{/) and