[PATCH] checkpatch: remove false positive for space before )

Artur Stupa posted 1 patch 1 week, 6 days ago
scripts/checkpatch.pl | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[PATCH] checkpatch: remove false positive for space before )
Posted by Artur Stupa 1 week, 6 days ago
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+\)/".

Suggested-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Link: https://lore.kernel.org/all/20250919212938.822374-1-deepanshu.pratik@gmail.com/T/#r517c63044278051aa381f7d17d1da2700e079d94

Signed-off-by: Artur Stupa <arthur.stupa@gmail.com>
---
 scripts/checkpatch.pl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 92669904eecc..00ee9258ab40 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -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) {
-- 
2.43.0