From 8af45b1f20f7f56a872297873f793655fe37f8e3 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 14 Jun 2020 10:54:08 -0600 Subject: checkpatch: Don't warn about PREFER_IF in headers/DT files This warning should only be displayed for C files. Fix it and update the test. Signed-off-by: Simon Glass --- 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 9544e57352..238f12cb46 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2343,7 +2343,7 @@ sub u_boot_line { } # use if instead of #if - if ($line =~ /^\+#if.*CONFIG.*/) { + if ($realfile =~ /\.c$/ && $line =~ /^\+#if.*CONFIG.*/) { WARN("PREFER_IF", "Use 'if (IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where possible\n" . $herecurr); } -- cgit