Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755477AbcJTIMu (ORCPT ); Thu, 20 Oct 2016 04:12:50 -0400 Received: from mail-qk0-f170.google.com ([209.85.220.170]:35432 "EHLO mail-qk0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753836AbcJTIMs (ORCPT ); Thu, 20 Oct 2016 04:12:48 -0400 From: Jerome Forissier To: Andy Whitcroft , Joe Perches , linux-kernel@vger.kernel.org Cc: Jerome Forissier Subject: [PATCH] checkpatch: don't match against empty $const_structs Date: Thu, 20 Oct 2016 10:12:06 +0200 Message-Id: <1476951126-30414-1-git-send-email-jerome.forissier@linaro.org> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 840 Lines: 27 When $conststructsfile does not exist or is empty, we may get false warnings such as: WARNING: struct should normally be const Fix that by not running the string match if $const_structs is empty. Signed-off-by: Jerome Forissier --- scripts/checkpatch.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index a8368d1..722a319 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -6010,7 +6010,8 @@ sub process { } # check for various structs that are normally const (ops, kgdb, device_tree) - if ($line !~ /\bconst\b/ && + if ($const_structs ne "" && + $line !~ /\bconst\b/ && $line =~ /\bstruct\s+($const_structs)\b/) { WARN("CONST_STRUCT", "struct $1 should normally be const\n" . -- 2.7.4