Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp31478rdd; Mon, 8 Jan 2024 16:27:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IE1iFZxniOigob9fLxFObnp5jiEDs5wl14RXRQx9O6GLmfXXe/gcF/SXmj7dYwu13Q0+hhw X-Received: by 2002:a17:906:aed2:b0:a28:ad3e:7071 with SMTP id me18-20020a170906aed200b00a28ad3e7071mr96960ejb.118.1704760058246; Mon, 08 Jan 2024 16:27:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704760058; cv=none; d=google.com; s=arc-20160816; b=XVXhcg5r1iwbya+rMVrGjckip4b4bfe0Gr8hvQXGzgNdiODSQNjNiryHfB7zFh2iAd fPzi4IZfpjHDBqpSqycIT/pVxtDntYlBUdOdr4nnGcedgvfeORfY2oSKwAwuPw0cq1Ta WZ9eUc8ujQtQHA+99ZhJ7EJatOpJmy43ZGF3h48LaxiKgemCzI12Hz0sh29VZfUpSLN2 o+cIzB/vsFUL153iXDz0hDVzZ9a2lDMkVygu4bGkzdYGYMI0P2DrWDvO0jckNQV4BAxQ ys4SSR7od7z+EL0+tWbRP16X6bA3pUPJbzdr/xwxKFchgdE7Edx8sED+xOl3EZWQ5KkB glYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=K52OVc4OIrG6xQXe/aL3B34cpskV9Nsp8/iW3w1SBeY=; fh=8QoclUR8Lubee5/UCiPj8WI5PPGw63woWFcKwzfZVgI=; b=mbGQ9hrLyjyIirYaYbx50xynDwrI6tGiKShJgFyBrucxJBkYPZMuBzuLiMMf9kQY5u npThxfV6NkgtGVhe1T98woygQk2AX0t3xwnEFtKisXRs6gIUtqlkHALgXmX650YSKZ8E 3YbpJASPtz+1uak0sOybEmtvvCYSH9hneJrvuf0AKcKSPD9RhUMsV2CYrHIFsZ0yqPTx vTjXqFBzpwDsg9wmieRWttDv9JRNfaXOW7HpIUrJAO82un+eLOVYH3Xp/rhCBbrkHxNz 3rMWQ0uK/fK0WV7npsjBDXK2C87xVfO7X9nSw2SWdjOVZqNrB2M4l00GM8Uo6vHgA1N2 LScg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-20212-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20212-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id w10-20020a170906384a00b00a29bac7a2c3si341075ejc.953.2024.01.08.16.27.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 16:27:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-20212-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-20212-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20212-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E75CF1F24190 for ; Tue, 9 Jan 2024 00:27:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A6B2D623; Tue, 9 Jan 2024 00:27:29 +0000 (UTC) Received: from omta002.cacentral1.a.cloudfilter.net (omta002.cacentral1.a.cloudfilter.net [3.97.99.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D1878191 for ; Tue, 9 Jan 2024 00:27:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=dilger.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=dilger.ca Received: from shw-obgw-4003a.ext.cloudfilter.net ([10.228.9.183]) by cmsmtp with ESMTPS id MwQLrilTOGAIJMzwErFEuj; Tue, 09 Jan 2024 00:25:50 +0000 Received: from webber.adilger.int ([70.77.200.158]) by cmsmtp with ESMTP id MzwDrA0jx0nMNMzwDrMW0D; Tue, 09 Jan 2024 00:25:50 +0000 X-Authority-Analysis: v=2.4 cv=Qcx1A+Xv c=1 sm=1 tr=0 ts=659c928e a=0Thh8+fbYSyN3T2vM72L7A==:117 a=0Thh8+fbYSyN3T2vM72L7A==:17 a=RPJ6JBhKAAAA:8 a=QQdngafKVaWhNDnW0jYA:9 a=fa_un-3J20JGBB2Tu-mn:22 From: Andreas Dilger To: Andy Whitcroft , Joe Perches Cc: linux-kernel@vger.kernel.org, Andreas Dilger Subject: [PATCH v2] checkpatch: ignore deleted lines for comment context Date: Mon, 8 Jan 2024 17:25:36 -0700 Message-Id: <20240109002536.56695-1-adilger@dilger.ca> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CMAE-Envelope: MS4xfIKe30+Lirkkrd59KOXxg9WzvL+y/mNDg5+p+ivw9SvC8yMdV8ASfGNtiTxRsGGh3F75Tt5629nnzfW8tibOpsJG72aqp+wpqZw7VjelHKP9v3zt3NyN Os6KOiFg1EBfBG5hbukFB2jOtAp05+CfsIvcDTTK2YfF1UUE1QxBFj7Q2iZBGlnXYQHKzxnMhLvcWub+KhG1OOE2Dd5se1GAwwG+MYSuAmUUL7LwNUN6sEnw 1+dFAxrbyKsX5/fUisSBWDTriXUmpWnpjaCe5fDZkLA4v5PAZTeZ5q9WlZZnV0B3 Don't consider lines being removed by a patch as part of the context. Otherwise, false "WARNING: memory barrier without comment" and similar warnings can be reported when a comment exists on the previous line. For example, a change like below was previously incorrectly flagged: /* matched by smp_store_release() in some_function() */ - if (smp_load_acquire(&list->tail) == head)) + if (smp_load_acquire(&list->tail) == head) && flags == 0) Signed-off-by: Andreas Dilger --- V1 -> V2: don't include extra debugging in 'warn' line scripts/checkpatch.pl | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 25fdb7fda112..316a65354718 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1973,6 +1973,7 @@ sub ctx_locate_comment { for (my $linenr = $first_line; $linenr < $end_line; $linenr++) { my $line = $rawlines[$linenr - 1]; #warn " $line\n"; + next if ($line =~ /^-/); # ignore lines removed by patch if ($linenr == $first_line and $line =~ m@^.\s*\*@) { $in_comment = 1; } -- 2.25.1