From bc22d9a7d3aa76bc090d844e6aad18db9cc69237 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Tue, 10 Apr 2018 16:33:53 -0700 Subject: checkpatch: test SYMBOLIC_PERMS multiple times per line There are occasions where symbolic perms are used in a ternary like return (channel == 0) ? S_IRUGO | S_IWUSR : S_IRUGO; The current test will find the first use "S_IRUGO | S_IWUSR" but not the second use "S_IRUGO" on the same line. Improve the test to look for all instances on a line. Link: http://lkml.kernel.org/r/1522127944.12357.49.camel@perches.com Signed-off-by: Joe Perches Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- scripts/checkpatch.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 5fe361e1ed5e..d2464002bb40 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -6429,7 +6429,7 @@ sub process { } # check for uses of S_ that could be octal for readability - if ($line =~ /\b($multi_mode_perms_string_search)\b/) { + while ($line =~ m{\b($multi_mode_perms_string_search)\b}g) { my $oval = $1; my $octal = perms_to_octal($oval); if (WARN("SYMBOLIC_PERMS", -- cgit v1.2.3