From: sashiko-bot@kernel.org
To: "Sibi Sankar" <sibi.sankar@oss.qualcomm.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH V9 1/3] dt-bindings: soundwire: qcom: Increase max data ports to 17
Date: Sat, 23 May 2026 09:11:34 +0000 [thread overview]
Message-ID: <20260523091134.851FB1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260523085511.2532669-2-sibi.sankar@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
New issues:
- [Medium] Globally increasing maxItems to 17 for port properties weakens schema validation for older SoundWire controllers that only support 16 ports.
Pre-existing issues:
- [High] Port allocation logic fails to properly check if the highest port is busy, leading to silent collisions where the maximum port index is allocated repeatedly when all lower ports are exhausted.
--
commit 4f104dadbb8cc83ffee25439c24bc3ee896cb832
Author: Sibi Sankar <sibi.sankar@oss.qualcomm.com>
dt-bindings: soundwire: qcom: Increase max data ports to 17
This patch bumps the maxItems from 16 to 17 for all qcom,ports-* properties.
This accommodates SoundWire controllers v3.1.0 which feature 17 data ports.
> diff --git a/Documentation/devicetree/bindings/soundwire/qcom,soundwire.yaml b/Documentation/devicetree/bindings/soundwire/qcom,soundwire.yaml
> index 9447a2f371b56..8e6973fa229c9 100644
> --- a/Documentation/devicetree/bindings/soundwire/qcom,soundwire.yaml
> +++ b/Documentation/devicetree/bindings/soundwire/qcom,soundwire.yaml
> @@ -90,7 +90,7 @@ properties:
> or applicable for the respective data port.
> More info in MIPI Alliance SoundWire 1.0 Specifications.
> minItems: 3
> - maxItems: 16
> + maxItems: 17
[Severity: Medium]
By globally increasing maxItems to 17, does this weaken schema validation
for older SoundWire controllers that physically only support 16 ports?
A device tree for older hardware (e.g., v1.3.0 to v2.2.0) could now incorrectly
specify 17 ports and pass dt_binding_check.
Should this use conditional allOf / if-then blocks based on the compatible
string to enforce generation-specific bounds?
[ ... ]
[Severity: High]
This isn't a bug introduced by this patch, but there appears to be a pre-existing
logic error in the dynamic port allocation that these bounds protect.
Looking at qcom_swrm_stream_alloc_ports():
drivers/soundwire/qcom.c:qcom_swrm_stream_alloc_ports() {
...
pn = find_first_zero_bit(port_mask, maxport);
if (pn > maxport) {
dev_err(ctrl->dev, "All ports busy\n");
return -EBUSY;
}
set_bit(pn, port_mask);
...
}
Because find_first_zero_bit() searches the range [0, maxport-1], it returns
maxport if no zero bits are found. If ports 1 to maxport-1 are all busy, the
check "if (pn > maxport)" evaluates to false.
Does this allow the code to blindly assign maxport and set its bit without
verifying if it was actually free?
It seems on subsequent allocations, the search will again find no zero bits and
repeatedly assign maxport, causing silent resource collisions where multiple
audio streams share the same hardware port.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260523085511.2532669-1-sibi.sankar@oss.qualcomm.com?part=1
next prev parent reply other threads:[~2026-05-23 9:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-23 8:55 [PATCH V9 0/3] Enable ADSP and CDSP for Glymur SoC Sibi Sankar
2026-05-23 8:55 ` [PATCH V9 1/3] dt-bindings: soundwire: qcom: Increase max data ports to 17 Sibi Sankar
2026-05-23 9:11 ` sashiko-bot [this message]
2026-05-26 9:09 ` Krzysztof Kozlowski
2026-05-23 8:55 ` [PATCH V9 2/3] arm64: dts: glymur: Add LPASS macro codecs and pinctrl Sibi Sankar
2026-05-23 8:55 ` [PATCH V9 3/3] arm64: dts: qcom: glymur-crd: add Audio sound card node Sibi Sankar
2026-05-23 11:25 ` sashiko-bot
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=20260523091134.851FB1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sibi.sankar@oss.qualcomm.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox