Skip to contentSkip to conversation

checkpatch: remove false positive for space before )

PATCH New Artur Stupa 1 participant 1 message Nov 18, 2025 Checkpatch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 checkpatch: remove false positive for space before )

checkpatch reports the following error when a macro ends with a comma and a space:

ERROR: space prohibited before that close parenthesis ')'

This patch adds the condition "$line !~ /,\s+\)/" to avoid such cases, following the similar rule above "$line !~ /:\s+\)/".

---
 scripts/checkpatch.pl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
scripts/checkpatch.pl +2 -1
index 92669904eecc..00ee9258ab40 100755
@@ -5494,7 +5494,8 @@ sub process {
 		}
 		if ($line =~ /(\s+)\)/ && $line !~ /^.\s*\)/ &&
 		    $line !~ /for\s*\(.*;\s+\)/ &&
-		    $line !~ /:\s+\)/) {
+		    $line !~ /:\s+\)/ &&
+		    $line !~ /,\s+\)/) {
 			if (ERROR("SPACING",
 				  "space prohibited before that close parenthesis ')'\n" . $herecurr) &&
 			    $fix) {
Signature · 1 line
2.43.0