History

checkpatch: warn about uses of ENOTSUPP

ENOTSUPP often feels like the right error code to use, but it's in fact not a standard Unix error. E.g.: $ python >>> import errno >>> errno.errorcode[errno.ENOTSUPP] Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: module 'errno' has no attribute 'ENOTSUPP' There were numerous commits converting the uses back to EOPNOTSUPP but in some cases we are stuck with the high error code for backward compatibility reasons. Let's try prevent more ENOTSUPPs from getting into the kernel. Recent example: https://lore.kernel.org/netdev/20200510182252.GA411829@lunn.ch/ v3 (Joe): - fix the "not file" condition. v2 (Joe): - add a link to recent discussion, - don't match when scanning files, not patches to avoid sudden influx of conversion patches. https://lore.kernel.org/netdev/20200511165319.2251678-1-kuba@kernel.org/ v1: https://lore.kernel.org/netdev/20200510185148.2230767-1-kuba@kernel.org/

Jakub Kicinski committed 6 years ago

Commit 6b9ea5f1 parent 97cf0ef1 file · +11 −0Browse files

Showing the changes to scripts/checkpatch.pl (1 of 1 file). Show all

Unified · Split

scripts/checkpatch.pl+11−0
@@ -4199,6 +4199,17 @@ sub process { · 4198 unmodified lines
4199 "ENOSYS means 'invalid syscall nr' and nothing else\n" . $herecurr);4199 "ENOSYS means 'invalid syscall nr' and nothing else\n" . $herecurr);
4200 }4200 }
4201 4201
4202# ENOTSUPP is not a standard error code and should be avoided in new patches.
4203# Folks usually mean EOPNOTSUPP (also called ENOTSUP), when they type ENOTSUPP.
4204# Similarly to ENOSYS warning a small number of false positives is expected.
4205 if (!$file && $line =~ /\bENOTSUPP\b/) {
4206 if (WARN("ENOTSUPP",
4207 "ENOTSUPP is not a SUSV4 error code, prefer EOPNOTSUPP\n" . $herecurr) &&
4208 $fix) {
4209 $fixed[$fixlinenr] =~ s/\bENOTSUPP\b/EOPNOTSUPP/;
4210 }
4211 }
4212
4202# function brace can't be on same line, except for #defines of do while,4213# function brace can't be on same line, except for #defines of do while,
4203# or if closed on same line4214# or if closed on same line
4204 if ($perl_version_ok &&4215 if ($perl_version_ok &&

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t