1 From 26001d54a7f803258b161f25f457ce11523695d7 Mon Sep 17 00:00:00 2001
2 From: Dan Carpenter <dan.carpenter@oracle.com>
3 Date: Fri, 21 Dec 2018 12:11:20 +0300
4 Subject: [PATCH] ASoC: pcm512x: Fix a double unlock in
7 [ Upstream commit 28b698b7342c7d5300cfe217cd77ff7d2a55e03d ]
9 We accidentally call mutex_unlock(&pcm512x->mutex); twice in a row.
11 I re-wrote the error handling to use "goto unlock;" instead of returning
12 directly. Hopefully, it makes the code a little simpler.
14 Fixes: 3500f1c589e9 ("ASoC: pcm512x: Implement the digital_mute interface")
15 Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
16 Reviwed-by: Dimitris Papavasiliou <dpapavas@gmail.com>
17 Signed-off-by: Mark Brown <broonie@kernel.org>
19 sound/soc/codecs/pcm512x.c | 11 ++++-------
20 1 file changed, 4 insertions(+), 7 deletions(-)
22 --- a/sound/soc/codecs/pcm512x.c
23 +++ b/sound/soc/codecs/pcm512x.c
24 @@ -1404,24 +1404,20 @@ static int pcm512x_digital_mute(struct s
26 dev_err(component->dev,
27 "Failed to set digital mute: %d\n", ret);
28 - mutex_unlock(&pcm512x->mutex);
33 regmap_read_poll_timeout(pcm512x->regmap,
34 PCM512x_ANALOG_MUTE_DET,
35 mute_det, (mute_det & 0x3) == 0,
38 - mutex_unlock(&pcm512x->mutex);
40 pcm512x->mute &= ~0x1;
41 ret = pcm512x_update_mute(pcm512x);
43 dev_err(component->dev,
44 "Failed to update digital mute: %d\n", ret);
45 - mutex_unlock(&pcm512x->mutex);
50 regmap_read_poll_timeout(pcm512x->regmap,
51 @@ -1432,9 +1428,10 @@ static int pcm512x_digital_mute(struct s
56 mutex_unlock(&pcm512x->mutex);
62 static int pcm512x_set_tdm_slot(struct snd_soc_dai *dai,