Re: [alsa-devel] [PATCH v2] soundwire: stream: fix bad unlock balance
From: Pierre-Louis Bossart
Date: Thu Jun 06 2019 - 10:32:32 EST
On 6/6/19 6:22 AM, Srinivas Kandagatla wrote:
multi bank switching code takes lock on condition but releases without
any check resulting in below warning.
This patch fixes this.
Question to make sure we are talking about the same thing: multi-link
bank switching is a capability beyond the scope of the SoundWire spec
which requires hardware support to synchronize links and as Sanyog
hinted at in a previous email follow a different flow for bank switches.
You would not use the multi-link mode if you have different links that
can operate independently and have no synchronization requirement. You
would conversely use the multi-link mode if you have two devices on the
same type on different links and want audio to be rendered at the same time.
Can you clarify if indeed you were using the full-blown multi-link mode
with hardware synchronization or a regular single-link operation? I am
not asking for details of your test hardware, just trying to reconstruct
the program flow leading to this problem.
It could also be that your commit message was meant to say:
"the msg lock is taken for multi-link cases only but released
unconditionally, leading to an unlock balance warning for single-link
WARNING: bad unlock balance detected!
5.1.0-16506-gc1c383a6f0a2-dirty #1523 Tainted: G W
aplay/2954 is trying to release lock (&bus->msg_lock) at:
but there are no more locks to release!
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@xxxxxxxxxx>
drivers/soundwire/stream.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c
index ce9cb7fa4724..73c52cd4fec8 100644
@@ -814,7 +814,8 @@ static int do_bank_switch(struct sdw_stream_runtime *stream)
+ if (bus->multi_link)