Skip to contentSkip to conversation

checkpatch: Don't warn about returning EPOLL* defines

PATCH New Ben Shelton 1 participant 1 message Dec 3, 2019 Checkpatch

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 checkpatch: Don't warn about returning EPOLL* defines

The EPOLL* defines are bit definitions, not errno values, so they should be returned as-is, not as negative values.

Cc Andy Whitcroft <[email protected]>
Cc Joe Perches <[email protected]>
---
 scripts/checkpatch.pl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
scripts/checkpatch.pl +2 -1
index 592911a..67ca588 100755
@@ -4869,7 +4869,8 @@ sub process {
 # Return of what appears to be an errno should normally be negative
 		if ($sline =~ /\breturn(?:\s*\(+\s*|\s+)(E[A-Z]+)(?:\s*\)+\s*|\s*)[;:,]/) {
 			my $name = $1;
-			if ($name ne 'EOF' && $name ne 'ERROR') {
+			if ($name ne 'EOF' && $name ne 'ERROR' &&
+			    $name !~ /EPOLL/) {
 				WARN("USE_NEGATIVE_ERRNO",
 				     "return of an errno should typically be negative (ie: return -$1)\n" . $herecurr);
 			}
Signature · 1 line
2.6.4