Commit 17441227f6258fc379c6ebfe21c3eec43b6f0de3
Committed by
Linus Torvalds
1 parent
ac5622418b
Exists in
master
and in
39 other branches
checkpatch: add warning for uses of printk_ratelimit
Warn about uses of printk_ratelimit() because it uses a global state and can hide subsequent useful messages. Signed-off-by: Joe Perches <joe@perches.com> Cc: Andy Whitcroft <apw@canonical.com> Cc: Richard Weinberger <richard@nod.at> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 1 changed file with 5 additions and 0 deletions Side-by-side Diff
scripts/checkpatch.pl
... | ... | @@ -1943,6 +1943,11 @@ |
1943 | 1943 | WARN("LINUX_VERSION_CODE should be avoided, code should be for the version to which it is merged\n" . $herecurr); |
1944 | 1944 | } |
1945 | 1945 | |
1946 | +# check for uses of printk_ratelimit | |
1947 | + if ($line =~ /\bprintk_ratelimit\s*\(/) { | |
1948 | + WARN("Prefer printk_ratelimited or pr_<level>_ratelimited to printk_ratelimit\n" . $herecurr); | |
1949 | + } | |
1950 | + | |
1946 | 1951 | # printk should use KERN_* levels. Note that follow on printk's on the |
1947 | 1952 | # same line do not need a level, so we use the current block context |
1948 | 1953 | # to try and find and validate the current printk. In summary the current |