summaryrefslogtreecommitdiff
path: root/scripts/checkpatch.pl
diff options
context:
space:
mode:
authorPetr Vorel <pvorel@suse.cz>2026-08-10 18:11:59 +0200
committerAndrew Morton <akpm@linux-foundation.org>2026-10-06 19:02:51 -0700
commitd41ebc7f9e2cc80cb57139c05e71415a79582ab0 (patch)
tree102ce06d0ab63a20841f64394f172442c21ca150 /scripts/checkpatch.pl
parentceb43516a9aae0d969a4ec5ab40d45bd09e64229 (diff)
downloadlinux-next-d41ebc7f9e2cc80cb57139c05e71415a79582ab0.tar.gz
linux-next-d41ebc7f9e2cc80cb57139c05e71415a79582ab0.zip
checkpatch: skip CamelCase cache for --no-tree without root
Running outside tree (--no-tree) without git root (--root DIR) is not doable because we have no include/ directory which could be cached. But 3445686af721 expected that we are always in Linux tree (w/a git). But --no-tree does not require --root. Therefore skip whole caching in that case. This fixes perl and find errors when running checkpatch.pl *with* --no-tree --strict and *without* --root: No structs that should be const will be found - file 'scripts/const_structs.checkpatch': No such file or directory Use of uninitialized value $root in concatenation (.) or string at scripts/checkpatch.pl line 1213. find: `/include': No such file or directory Link: https://lore.kernel.org/20260810161159.1044160-1-pvorel@suse.cz Fixes: 3445686af721 ("checkpatch: ignore existing CamelCase uses from include/...") Signed-off-by: Petr Vorel <pvorel@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Cc: Andy Whitcroft <apw@canonical.com> Cc: Dwaipayan Ray <dwaipayanray1@gmail.com> Cc: Joe Perches <joe@perches.com> Cc: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-xscripts/checkpatch.pl2
1 files changed, 2 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 8a7787d228a6..f424dafce5bc 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1206,6 +1206,8 @@ sub seed_camelcase_includes {
my $git_last_include_commit = `${git_command} log --no-merges --pretty=format:"%h%n" -1 -- include`;
chomp $git_last_include_commit;
$camelcase_cache = ".checkpatch-camelcase.git.$git_last_include_commit";
+ } elsif (not defined $root) {
+ return;
} else {
my $last_mod_date = 0;
$files = `find $root/include -name "*.h"`;