forked from Minki/linux
ASoC: pcm512x: Fix a double unlock in pcm512x_digital_mute()
We accidentally call mutex_unlock(&pcm512x->mutex); twice in a row.
I re-wrote the error handling to use "goto unlock;" instead of returning
directly. Hopefully, it makes the code a little simpler.
Fixes: 3500f1c589
("ASoC: pcm512x: Implement the digital_mute interface")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviwed-by: Dimitris Papavasiliou <dpapavas@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
fd270fca20
commit
28b698b734
@ -1400,24 +1400,20 @@ static int pcm512x_digital_mute(struct snd_soc_dai *dai, int mute)
|
|||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
dev_err(component->dev,
|
dev_err(component->dev,
|
||||||
"Failed to set digital mute: %d\n", ret);
|
"Failed to set digital mute: %d\n", ret);
|
||||||
mutex_unlock(&pcm512x->mutex);
|
goto unlock;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
regmap_read_poll_timeout(pcm512x->regmap,
|
regmap_read_poll_timeout(pcm512x->regmap,
|
||||||
PCM512x_ANALOG_MUTE_DET,
|
PCM512x_ANALOG_MUTE_DET,
|
||||||
mute_det, (mute_det & 0x3) == 0,
|
mute_det, (mute_det & 0x3) == 0,
|
||||||
200, 10000);
|
200, 10000);
|
||||||
|
|
||||||
mutex_unlock(&pcm512x->mutex);
|
|
||||||
} else {
|
} else {
|
||||||
pcm512x->mute &= ~0x1;
|
pcm512x->mute &= ~0x1;
|
||||||
ret = pcm512x_update_mute(pcm512x);
|
ret = pcm512x_update_mute(pcm512x);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
dev_err(component->dev,
|
dev_err(component->dev,
|
||||||
"Failed to update digital mute: %d\n", ret);
|
"Failed to update digital mute: %d\n", ret);
|
||||||
mutex_unlock(&pcm512x->mutex);
|
goto unlock;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
regmap_read_poll_timeout(pcm512x->regmap,
|
regmap_read_poll_timeout(pcm512x->regmap,
|
||||||
@ -1428,9 +1424,10 @@ static int pcm512x_digital_mute(struct snd_soc_dai *dai, int mute)
|
|||||||
200, 10000);
|
200, 10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unlock:
|
||||||
mutex_unlock(&pcm512x->mutex);
|
mutex_unlock(&pcm512x->mutex);
|
||||||
|
|
||||||
return 0;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct snd_soc_dai_ops pcm512x_dai_ops = {
|
static const struct snd_soc_dai_ops pcm512x_dai_ops = {
|
||||||
|
Loading…
Reference in New Issue
Block a user