From patchwork Wed Jul 3 08:30:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miles Chen X-Patchwork-Id: 11029073 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CFA491398 for ; Wed, 3 Jul 2019 08:30:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C09C4266F3 for ; Wed, 3 Jul 2019 08:30:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B1FCF286CF; Wed, 3 Jul 2019 08:30:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0334A266F3 for ; Wed, 3 Jul 2019 08:30:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=2q/FDBGzQtAQmZEKNflUhlcMEdfgoo130e/8pr4z20w=; b=b2VAN6wBNSjRgr NK7qJcPdUHPgnsHp1WASGJme1xOnjAy9eMyueVieHmZ5FW6Khn7jsEm5M8p212SJRC2Tp9WLTayqX G0MQzlzvpi9k/FG0t1ftpOQz4S559DZQoyTkhbTPXebKqL+A4iVK4QiK7eZUbsEKtrgNXHX22p+8C kQO5F4l7HS0fLaZk4M2NLexX0xHkhevJmHQRmBNYgTHCrC/b1HGH33nK3w9zMzJdWAejak4BWXqgw lcywmoQQDR9KMwfC0ZRrNJVvy40Pavd44S7Jy/wSpdwLi4DdF/jvA8QDWe6HwETmQCYsFdrjZJ64U guJAaHH1mHfMja2UV75A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hiafF-0002vv-W6; Wed, 03 Jul 2019 08:30:53 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hiafC-0002uc-5i for linux-mediatek@lists.infradead.org; Wed, 03 Jul 2019 08:30:52 +0000 X-UUID: a42526ba8995457898aa55c33871a3c1-20190703 X-UUID: a42526ba8995457898aa55c33871a3c1-20190703 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 406461079; Wed, 03 Jul 2019 00:30:35 -0800 Received: from MTKMBS07N2.mediatek.inc (172.21.101.141) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 3 Jul 2019 01:30:33 -0700 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 3 Jul 2019 16:30:32 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Wed, 3 Jul 2019 16:30:32 +0800 From: Miles Chen To: Andy Whitcroft , Joe Perches Subject: [PATCH] checkpatch: avoid default n Date: Wed, 3 Jul 2019 16:30:31 +0800 Message-ID: <20190703083031.2950-1-miles.chen@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190703_013050_226572_69896F56 X-CRM114-Status: UNSURE ( 6.42 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Miles Chen , linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, wsd_upstream@mediatek.com Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This change reports a warning when "default n" is used. I have seen several "remove default n" patches, so I think it might be helpful to add this test in checkpatch. tested: WARNING: 'default n' is the default value, no need to write it explicitly. + default n Signed-off-by: Miles Chen --- scripts/checkpatch.pl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 342c7c781ba5..6531b5757c6b 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -3005,6 +3005,13 @@ sub process { "Use of boolean is deprecated, please use bool instead.\n" . $herecurr); } +# avoid redundant 'default n' + if ($realfile =~ /Kconfig/ && + $line =~ /^\+\s*\bdefault n\b/) { + WARN("AVOID_DEFAULT_N", + "'default n' is the default value, no need to write it explicitly.\n" . $herecurr); + } + if (($realfile =~ /Makefile.*/ || $realfile =~ /Kbuild.*/) && ($line =~ /\+(EXTRA_[A-Z]+FLAGS).*/)) { my $flag = $1;