Re: [PATCH v3] checkpatch: Check WQ_PERCPU or WQ_UNBOUND presence in alloc_workqueue() users
From: Joe Perches
Date: Fri Jun 05 2026 - 21:22:43 EST
On Fri, 2026-06-05 at 09:43 +0200, Marco Crivellari wrote:
> The workqueue API introduced a new flag, WQ_PERCPU, that has to be used when
> WQ_UNBOUND is not present. One of these flags must be present, but not
> both of them.
[]
> Signed-off-by: Marco Crivellari <[marco.crivellari@xxxxxxxx](mailto:marco.crivellari@xxxxxxxx)>
> ---
> Changes in v3:
> - code aligned to open parens
Not so.
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -7804,8 +7804,31 @@ sub process {
> ERROR("UNINITIALIZED_PTR_WITH_FREE",
> "pointer '$1' with __free attribute should be initialized\n" . $herecurr);
> }
> - }
>
> +# check alloc_workqueue() parameters for WQ_PERCPU and WQ_UNBOUND uses
> + if (defined($stat) &&
> + $stat =~ /^[ \+]\s*(?:$Lval\s*=\s*)?((?:devm_)?alloc_workqueue)\s*($balanced_parens)/) {
Properly aligned would be 2 tabs then 4 spaces
$stat =~ /^[ \+]\s*(?:$Lval\s*=\s*)?((?:devm_)?alloc_workqueue)\s*($balanced_parens)/) {
[]
> + if (defined($error_msg)) {
> + my $stmt_cnt = statement_rawlines($stat);
> + my $herectx = get_stat_here($linenr, $stmt_cnt, $here);
> + WARN("ALLOC_WORKQUEUE_FLAGS",
> + $error_msg . $herectx);
4 tabs then 5 spaces