[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1375740651-7716-1-git-send-email-andi@firstfloor.org>
Date: Mon, 5 Aug 2013 15:10:51 -0700
From: Andi Kleen <andi@...stfloor.org>
To: apw@...onical.com
Cc: joe@...ches.com, linux-kernel@...r.kernel.org,
Andi Kleen <ak@...ux.intel.com>
Subject: [PATCH] checkpatch: add a rule to check devinitconst mistakes
From: Andi Kleen <ak@...ux.intel.com>
Check for const __devinitdata and non const __devinitconst
People get this regularly wrong and it breaks the LTO builds,
as it causes a section attribute conflict.
This doesn't catch all mistakes -- spreading over multiple lines,
getting const pointers wrong, but hopefully the common ones.
Signed-off-by: Andi Kleen <ak@...ux.intel.com>
---
scripts/checkpatch.pl | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 2ee9eb7..5d68d9c 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2676,6 +2676,15 @@ sub process {
}
}
+# check for __devinitdata with const or const without __devintconst
+# XXX should scan multiple lines and handle misplaced consts for pointers
+ if ($line =~ /const/ && $line =~ /__(dev)?initdata/) {
+ ERROR("DEVINITCONST", "const init definition must use __devinitconst");
+ }
+ if ($line =~ /__(dev)?initconst/ && $line !~ /\Wconst\W/) {
+ ERROR("DEVINITCONST", "__devinitconst must have have const definition");
+ }
+
# check for spacing round square brackets; allowed:
# 1. with a type on the left -- int [] a;
# 2. at the beginning of a line for slice initialisers -- [0...10] = 5,
--
1.8.3.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists