aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/checkpatch.pl
diff options
context:
space:
mode:
authorMarco Elver <elver@google.com>2020-04-01 12:17:14 +0200
committerPaul E. McKenney <paulmck@kernel.org>2020-05-06 10:54:58 -0700
commit5099a722e9727fe9a93fac51e961735f40e5b6c8 (patch)
tree48dd8039040943c781b8c9e984ece042dc1faf5d /scripts/checkpatch.pl
parent52785b6ae8eded7ac99d65c92d989b702e5b4376 (diff)
downloadlinux-5099a722e9727fe9a93fac51e961735f40e5b6c8.tar.gz
checkpatch: Warn about data_race() without comment
Warn about applications of data_race() without a comment, to encourage documenting the reasoning behind why it was deemed safe. Suggested-by: Will Deacon <will@kernel.org> Signed-off-by: Marco Elver <elver@google.com> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-xscripts/checkpatch.pl8
1 files changed, 8 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index a63380c6b0d20..48bb9508e3009 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5833,6 +5833,14 @@ sub process {
}
}
+# check for data_race without a comment.
+ if ($line =~ /\bdata_race\s*\(/) {
+ if (!ctx_has_comment($first_line, $linenr)) {
+ WARN("DATA_RACE",
+ "data_race without comment\n" . $herecurr);
+ }
+ }
+
# check for smp_read_barrier_depends and read_barrier_depends
if (!$file && $line =~ /\b(smp_|)read_barrier_depends\s*\(/) {
WARN("READ_BARRIER_DEPENDS",