Skip to content

Commit 6e27b7d

Browse files
committed
checkpatch: exclude lib/posix/*.c from negative errno rule
The `USE_NEGATIVE_ERRNO` rule consistently generates false positives when working with certain areas of POSIX. It makes sense to disable this check for the POSIX API rather than requiring merge superpowers constantly. That way, we can merge as per usual after sufficient approvals rather than waiting for someone with merge superpowers to override / manually merge. Signed-off-by: Christopher Friedt <[email protected]>
1 parent 1f8d2e4 commit 6e27b7d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

scripts/checkpatch.pl

+5-2
Original file line numberDiff line numberDiff line change
@@ -5014,8 +5014,11 @@ sub process {
50145014
if ($sline =~ /\breturn(?:\s*\(+\s*|\s+)(E[A-Z]+)(?:\s*\)+\s*|\s*)[;:,]/) {
50155015
my $name = $1;
50165016
if ($name ne 'EOF' && $name ne 'ERROR') {
5017-
WARN("USE_NEGATIVE_ERRNO",
5018-
"return of an errno should typically be negative (ie: return -$1)\n" . $herecurr);
5017+
# only print this warning if not dealing with 'lib/posix/*.c'
5018+
if ($realfile =~ /.*\/lib\/posix\/*.c/) {
5019+
WARN("USE_NEGATIVE_ERRNO",
5020+
"return of an errno should typically be negative (ie: return -$1)\n" . $herecurr);
5021+
}
50195022
}
50205023
}
50215024

0 commit comments

Comments
 (0)