From patchwork Tue Jan 9 00:25:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Dilger X-Patchwork-Id: 186180 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:37c1:b0:101:2151:f287 with SMTP id y1csp1360896dyq; Mon, 8 Jan 2024 16:27:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IGzFvjw7C3nz41oX6tBxNPqpNIDXxsA0AF6Dru0scxe9rvifU03HwMUW0Puo2D6nNsBDNZE X-Received: by 2002:a17:907:aa2:b0:a28:fab0:a88c with SMTP id bz2-20020a1709070aa200b00a28fab0a88cmr107433ejc.78.1704760067461; Mon, 08 Jan 2024 16:27:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704760067; cv=none; d=google.com; s=arc-20160816; b=Fk+7fYbYBRPaRwkGdQ9y7KMgxU+w8tqmXmEnDs5R2KCrVN3f8aDuvqw5jLmq/kOkth Z7WkLjW3Xe8l3ha4paOW0tsYNGNZFotTJXK+UAXvq/P+aErpeUAIO0e/O4y2whoMMEX/ XdJjSIr4sC/ZIbtJJ3toZ8zIUj07sJcpKYsKORakePBRgYqmXsuKk1XECaYxP5Q+5LgB qMhyXMBt4pVDYxWXsdAKtNJgu/mwIIJqK1o9YamZyG4rRSkoB+07VZRRCi7RjyFZyS0H sjWCpF6TRtZhls3EC2xu5PeuDjdPeZUR10stjY1WuVJcLvKIHoQO9RECMyOfUYKlN/55 namQ== 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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20212-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id lc8-20020a170906f90800b00a28069f681asi367839ejb.834.2024.01.08.16.27.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 16:27:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-20212-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-20212-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20212-ouuuleilei=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 09BA31F23EFC for ; Tue, 9 Jan 2024 00:27:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A7C16A50; Tue, 9 Jan 2024 00:27:30 +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 X-CMAE-Envelope: MS4xfIKe30+Lirkkrd59KOXxg9WzvL+y/mNDg5+p+ivw9SvC8yMdV8ASfGNtiTxRsGGh3F75Tt5629nnzfW8tibOpsJG72aqp+wpqZw7VjelHKP9v3zt3NyN Os6KOiFg1EBfBG5hbukFB2jOtAp05+CfsIvcDTTK2YfF1UUE1QxBFj7Q2iZBGlnXYQHKzxnMhLvcWub+KhG1OOE2Dd5se1GAwwG+MYSuAmUUL7LwNUN6sEnw 1+dFAxrbyKsX5/fUisSBWDTriXUmpWnpjaCe5fDZkLA4v5PAZTeZ5q9WlZZnV0B3 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787570492290928098 X-GMAIL-MSGID: 1787570492290928098 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; }