* [PATCH v2] scripts/checkpatch: check for uses of trace_printk
@ 2015-04-08 8:53 Juri Lelli
0 siblings, 0 replies; only message in thread
From: Juri Lelli @ 2015-04-08 8:53 UTC (permalink / raw)
To: joe; +Cc: linux-kernel, Juri Lelli, Andy Whitcroft, Steven Rostedt, Juri Lelli
Production kernels will scream if trace_printk() is used (thanks to
Steve's banner). Rather than waiting for that to happen, let's check
patches beforehand.
Signed-off-by: Juri Lelli <juri.lelli@arm.com>
Cc: Andy Whitcroft <apw@canonical.com>
Cc: Joe Perches <joe@perches.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Juri Lelli <juri.lelli@gmail.com>
Cc: linux-kernel@vger.kernel.org
---
Changes since v1:
o added an exception when the code is in kernel/trace/, as suggested
by Steve and Joe;
scripts/checkpatch.pl | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index d124359..c36b2b7 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3257,6 +3257,13 @@ sub process {
"Prefer printk_ratelimited or pr_<level>_ratelimited to printk_ratelimit\n" . $herecurr);
}
+# check for uses of trace_printk
+ if ($realfile !~ m@kernel/trace/@ &&
+ $line =~ /\btrace_printk\s*\(/) {
+ ERROR("TRACE_PRINTK",
+ "Never use trace_printk in production code!\n" . $herecurr);
+ }
+
# printk should use KERN_* levels. Note that follow on printk's on the
# same line do not need a level, so we use the current block context
# to try and find and validate the current printk. In summary the current
--
2.3.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-04-08 8:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-08 8:53 [PATCH v2] scripts/checkpatch: check for uses of trace_printk Juri Lelli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®