]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
soundwire: stream: fix bad unlock balance
authorSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Thu, 6 Jun 2019 11:22:22 +0000 (12:22 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 14 Jul 2019 06:09:38 +0000 (08:09 +0200)
[ Upstream commit 9315d904c7e8f38886e2820fa6cb8d0fa723ea21 ]

the msg lock is taken for multi-link cases only but released
unconditionally, leading to an unlock balance warning for single-link usages
This patch fixes this.

 =====================================
 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:
 do_bank_switch+0x21c/0x480
 but there are no more locks to release!

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Acked-by: Sanyog Kale <sanyog.r.kale@intel.com>
[vkoul: edited the change log as suggested by Pierre]
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/soundwire/stream.c

index 00618de2ee12f6102b438b55a4da0927d26c3166..794ced434cf2328f880e32a5d0856c51647feea7 100644 (file)
@@ -805,7 +805,8 @@ static int do_bank_switch(struct sdw_stream_runtime *stream)
                        goto error;
                }
 
-               mutex_unlock(&bus->msg_lock);
+               if (bus->multi_link)
+                       mutex_unlock(&bus->msg_lock);
        }
 
        return ret;