From 362173572a4018e9c8e39c616823189c41d39d41 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Tue, 24 Jan 2023 15:16:55 -0800 Subject: checkpatch: improve EMBEDDED_FILENAME test Privately, Heinz Mauelshagen showed that the embedded filename test is not specific enough. > WARNING: It's generally not useful to have the filename in the file > #113: FILE: errors.c:113: > + block < registered_errors.blocks + registered_errors.count; Extend the test to use the appropriate word boundary tests. Link: https://lkml.kernel.org/r/36069dac5d07509dab1c7f1238f8cbb08db80ac6.camel@perches.com Signed-off-by: Joe Perches Reported-by: Heinz Mauelshagen Signed-off-by: Andrew Morton --- scripts/checkpatch.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts/checkpatch.pl') diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index a2fc7d556126..bd44d12965c9 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -3751,7 +3751,7 @@ sub process { } # check for embedded filenames - if ($rawline =~ /^\+.*\Q$realfile\E/) { + if ($rawline =~ /^\+.*\b\Q$realfile\E\b/) { WARN("EMBEDDED_FILENAME", "It's generally not useful to have the filename in the file\n" . $herecurr); } -- cgit v1.2.3