mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 22:14:03 +02:00
soundwire: qcom: Fix port exhaustion check in stream_alloc_ports
find_first_zero_bit(mask, n) returns n (not n+1) when all bits are set,
so the guard `pn > maxport` is never true on exhaustion. The driver
would silently call set_bit(maxport, port_mask) and assign the
out-of-range port instead of returning -EBUSY. Fix the comparison to
`pn >= maxport`.
Fixes: 02efb49aa8 ("soundwire: qcom: add support for SoundWire controller")
Reported-by: sashiko-bot <sashiko-bot@kernel.org>
Assisted-by: Claude Sonnet 4.6
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
Link: https://patch.msgid.link/20260701193006.4113-2-srinivas.kandagatla@oss.qualcomm.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
This commit is contained in:
parent
b496bb56b4
commit
6ccec91c35
|
|
@ -1271,7 +1271,7 @@ static int qcom_swrm_stream_alloc_ports(struct qcom_swrm_ctrl *ctrl,
|
|||
else
|
||||
pn = find_first_zero_bit(port_mask, maxport);
|
||||
|
||||
if (pn > maxport) {
|
||||
if (pn >= maxport) {
|
||||
dev_err(ctrl->dev, "All ports busy\n");
|
||||
return -EBUSY;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user