mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-01-19 02:08:16 +07:00
checkpatch: warn on comparisons to jiffies
Comparing jiffies is almost always wrong and time_before and time_after should be used instead. Warn on any comparison to jiffies. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
a605e32ebd
commit
36ec19390e
@ -3299,6 +3299,12 @@ sub process {
|
||||
}
|
||||
}
|
||||
|
||||
# check for comparisons of jiffies
|
||||
if ($line =~ /\bjiffies\s*$Compare|$Compare\s*jiffies\b/) {
|
||||
WARN("JIFFIES_COMPARISON",
|
||||
"Comparing jiffies is almost always wrong; prefer time_after, time_before and friends\n" . $herecurr);
|
||||
}
|
||||
|
||||
# warn about #ifdefs in C files
|
||||
# if ($line =~ /^.\s*\#\s*if(|n)def/ && ($realfile =~ /\.c$/)) {
|
||||
# print "#ifdef in C files should be avoided\n";
|
||||
|
Loading…
Reference in New Issue
Block a user