From patchwork Thu Oct 20 08:12:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 78436 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp654838qge; Thu, 20 Oct 2016 01:12:54 -0700 (PDT) X-Received: by 10.98.79.27 with SMTP id d27mr19029533pfb.165.1476951174814; Thu, 20 Oct 2016 01:12:54 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 20si40622521pgk.101.2016.10.20.01.12.54; Thu, 20 Oct 2016 01:12:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757222AbcJTIMu (ORCPT + 27 others); 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 Received: by mail-qk0-f170.google.com with SMTP id z190so78559128qkc.2 for ; Thu, 20 Oct 2016 01:12:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=6YH9FtUFT3Z5L2SwAw8PmJFXp/xWhJFwxYbNP3ob2gs=; b=UjgcmsWWnEwubhJ3Jk463VcAHblxdwXgmvvKshHIi+0kA9oPGhdND6b2KwT2cjNDVM bcetFKlqrloAjlyc4LER0JXD73fE5pmov+5rnHRd8Ytz2mLBnF2UTXJMg1aZGPI2e9jf bk25MjQ2qpdgHryhv66Jr0BkB7Jq3OojRn3n0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=6YH9FtUFT3Z5L2SwAw8PmJFXp/xWhJFwxYbNP3ob2gs=; b=BYrnLaxrSKP0TR8phskTA39Zzt23HMRr+Nl4WFieoVys+5MrSB9mUMDaLHTrtRdLS+ /n1jtjpiwix2qK1+u7GyqdHVvu6YWc1pdUMyZg9qwY7zxOA6QAnLM4OgjOSAYgoWBRqg tL2vvqGYtpi4+0NjtOyWWpf95jr8+U3E757PlQyEiS1QpZshQZ5j7IMAwEuqzHxiGKYW ln618kLW+DsmEvRf0aiwoiSQfj5FForaGLDGc0GhXyT9q4y2BbknMa9xPExhAnMK8Uw0 EWjrhOLCa0+ZFAxJaHtGFQR61RZ/eB1e0zT0SEqg+9n4wvwiRWAbujI0QxlK1Jj0fFuF PDYg== X-Gm-Message-State: AA6/9RnIzOW0FR02HtmOFwi5p93I9o48TOE0BSRC+7F7GpgTsO3uwvPI5AsLD63IIheDd1mX X-Received: by 10.194.178.100 with SMTP id cx4mr7338660wjc.15.1476951166873; Thu, 20 Oct 2016 01:12:46 -0700 (PDT) Received: from jfw540.home (ANice-653-1-607-119.w86-205.abo.wanadoo.fr. [86.205.79.119]) by smtp.gmail.com with ESMTPSA id i10sm62536339wjw.1.2016.10.20.01.12.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 20 Oct 2016 01:12:46 -0700 (PDT) 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.7.4 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" .