Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753646AbbDHIy0 (ORCPT ); Wed, 8 Apr 2015 04:54:26 -0400 Received: from foss.arm.com ([217.140.101.70]:49918 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752269AbbDHIyT (ORCPT ); Wed, 8 Apr 2015 04:54:19 -0400 From: Juri Lelli To: joe@perches.com Cc: linux-kernel@vger.kernel.org, Juri Lelli , Andy Whitcroft , Steven Rostedt , Juri Lelli Subject: [PATCH v2] scripts/checkpatch: check for uses of trace_printk Date: Wed, 8 Apr 2015 09:53:48 +0100 Message-Id: <1428483228-5232-1-git-send-email-juri.lelli@arm.com> X-Mailer: git-send-email 2.2.2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1556 Lines: 45 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 Cc: Andy Whitcroft Cc: Joe Perches Cc: Steven Rostedt Cc: Juri Lelli 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__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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/