From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,joe@perches.com,jic23@kernel.org,apw@canonical.com,alison.schofield@intel.com,kanie@linux.alibaba.com,akpm@linux-foundation.org
Subject: [merged mm-nonmm-stable] checkpatch-dont-flag-acquire_err-assignments-in-if-conditions.patch removed from -mm tree
Date: Sun, 11 Oct 2026 15:20:01 -0700 [thread overview]
Message-ID: <20261011222001.E563F1F0089B@smtp.kernel.org> (raw)
The quilt patch titled
Subject: checkpatch: don't flag ACQUIRE_ERR() assignments in if conditions
has been removed from the -mm tree. Its filename was
checkpatch-dont-flag-acquire_err-assignments-in-if-conditions.patch
This patch was dropped because it was merged into the mm-nonmm-stable branch
of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Guixin Liu <kanie@linux.alibaba.com>
Subject: checkpatch: don't flag ACQUIRE_ERR() assignments in if conditions
Date: Thu, 24 Sep 2026 11:39:23 +0800
ACQUIRE_ERR() and its wrappers, PM_RUNTIME_ACQUIRE_ERR() and
IIO_DEV_ACQUIRE_FAILED(), report whether a conditional cleanup.h guard was
acquired, and drivers consume the result directly in an if condition:
if ((rc = ACQUIRE_ERR(mutex_intr, &lock)))
return rc;
That combined form is the established style at the 49 in-tree call sites
under drivers/cxl and drivers/pci/tsm.c, so ASSIGN_IN_IF fires there only
as a false positive, and every patch touching those lines carries noise
that reviewers have to wave off manually.
Skip the check only when every assignment in the condition assigns the
result of such a call, matched by the *_ACQUIRE_ERR() / *_ACQUIRE_FAILED()
naming convention of its wrappers. Plain assignments, mixed conditions
and near-miss identifiers still get flagged.
Link: https://lore.kernel.org/20260924033923.4140210-1-kanie@linux.alibaba.com
Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Suggested-by: Alison Schofield <alison.schofield@intel.com>
Acked-by: Joe Perches <joe@perches.com>
Assisted-by: LLM
Cc: Andy Whitcroft <apw@canonical.com>
Cc: Jonathan Cameron <jic23@kernel.org>
---
scripts/checkpatch.pl | 14 ++++++++++++++
1 file changed, 14 insertions(+)
--- a/scripts/checkpatch.pl~checkpatch-dont-flag-acquire_err-assignments-in-if-conditions
+++ a/scripts/checkpatch.pl
@@ -5787,7 +5787,21 @@ sub process {
my ($s, $c) = ($stat, $cond);
my $fixed_assign_in_if = 0;
+ # ACQUIRE_ERR() and its wrappers, e.g. PM_RUNTIME_ACQUIRE_ERR()
+ # and IIO_DEV_ACQUIRE_FAILED(), are meant to be evaluated in an
+ # if condition, with the error assigned in the condition:
+ # if ((rc = ACQUIRE_ERR(name, &lock)))
+ # Allow that only when every assignment in the condition assigns
+ # the result of such a call, so that a mixed condition keeps
+ # getting flagged:
+ # if ((rc = regular_function()) || (ret = ACQUIRE_ERR(name, &lock)))
+ my $assign_in_if = 0;
if ($c =~ /\bif\s*\(.*[^<>!=]=[^=].*/s) {
+ my $has_assignment = $c =~ /\b$Lval\s*=\s*[^,)&|=]+/;
+ my $has_other_assignment = $c =~ /\b$Lval\s*=\s*(?!\s*\w*ACQUIRE_(?:ERR|FAILED)\s*\()[^,)&|=]+/;
+ $assign_in_if = !$has_assignment || $has_other_assignment;
+ }
+ if ($assign_in_if) {
if (ERROR("ASSIGN_IN_IF",
"do not use assignment in if condition\n" . $herecurr) &&
$fix && $perl_version_ok) {
_
Patches currently in -mm which might be from kanie@linux.alibaba.com are
reply other threads:[~2026-10-11 22:20 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261011222001.E563F1F0089B@smtp.kernel.org \
--to=akpm@linux-foundation.org \
--cc=alison.schofield@intel.com \
--cc=apw@canonical.com \
--cc=jic23@kernel.org \
--cc=joe@perches.com \
--cc=kanie@linux.alibaba.com \
--cc=mm-commits@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.