Commit 6c9e9046 authored by Fei Shao's avatar Fei Shao Committed by Mark Brown

ASoC: mediatek: mt8186: Fix mutex double unlock in GPIO request

The lockdep mechanism revealed an unbalanced unlocking on MT8186:

  [    2.993966] WARNING: bad unlock balance detected!
  [    2.993978] -------------------------------------
  [    2.993983] kworker/u16:1/10 is trying to release lock (gpio_request_mutex) at:
  [    2.993994] [<ffffffdcd9adebf8>] mt8186_afe_gpio_request+0xf8/0x210
  [    2.994012] but there are no more locks to release!

The cause is that the mutex will be double unlocked if dai is unknown
during GPIO selection, and this patch fixes it.

Fixes: cfa9a966 ("ASoC: mediatek: mt8186: support gpio control in platform driver")
Signed-off-by: default avatarFei Shao <fshao@chromium.org>
Link: https://lore.kernel.org/r/20220617111003.2014395-1-fshao@chromium.orgSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 44230200
......@@ -230,7 +230,6 @@ int mt8186_afe_gpio_request(struct device *dev, bool enable,
sel = enable ? MT8186_AFE_GPIO_PCM_ON : MT8186_AFE_GPIO_PCM_OFF;
break;
default:
mutex_unlock(&gpio_request_mutex);
dev_err(dev, "%s(), invalid dai %d\n", __func__, dai);
goto unlock;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment