Re: [PATCH v2] checkpatch: don't flag ACQUIRE_ERR() assignments in if conditions

From: Jonathan Cameron

Date: Fri Sep 25 2026 - 19:10:54 EST


On Thu, 24 Sep 2026 11:39:23 +0800
Guixin Liu <kanie@xxxxxxxxxxxxxxxxx> wrote:

> 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.
>
> Suggested-by: Alison Schofield <alison.schofield@xxxxxxxxx>
> Cc: linux-cxl@xxxxxxxxxxxxxxx
> Assisted-by: LLM
> Signed-off-by: Guixin Liu <kanie@xxxxxxxxxxxxxxxxx>
>
I'm thoroughly in favour but seeing as I'd end up using an LLM
just to figure out what the actual code does no tags from me!

Jonathan