Skip to content

Commit 5099a72

Browse files
melverpaulmckrcu
authored andcommitted
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 <[email protected]> Signed-off-by: Marco Elver <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
1 parent 52785b6 commit 5099a72

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

scripts/checkpatch.pl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5833,6 +5833,14 @@ sub process {
58335833
}
58345834
}
58355835

5836+
# check for data_race without a comment.
5837+
if ($line =~ /\bdata_race\s*\(/) {
5838+
if (!ctx_has_comment($first_line, $linenr)) {
5839+
WARN("DATA_RACE",
5840+
"data_race without comment\n" . $herecurr);
5841+
}
5842+
}
5843+
58365844
# check for smp_read_barrier_depends and read_barrier_depends
58375845
if (!$file && $line =~ /\b(smp_|)read_barrier_depends\s*\(/) {
58385846
WARN("READ_BARRIER_DEPENDS",

0 commit comments

Comments
 (0)