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 <sjg@chromium.org>
This commit is contained in:
Simon Glass
2020-07-09 18:57:22 -06:00
parent 5c430761e6
commit 8af45b1f20
2 changed files with 3 additions and 1 deletions
+1 -1
View File
@@ -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);
}