[alsa-devel] [PATCH] ASoC: Use codec mutex in dapm_set_pga()
ext-eero.nurkkala at nokia.com
ext-eero.nurkkala at nokia.com
Thu Oct 1 08:17:36 CEST 2009
From: Eero Nurkkala <ext-eero.nurkkala at nokia.com>
codec->mutex seems required if widget->* values
are altered. Moreover, snd_soc_dapm_put_volsw()
may alter widget->saved_value. dapm_set_pga()
uses widget->saved_value in a for loop which now
has a distant chance of getting out of control.
Signed-off-by: Eero Nurkkala <ext-eero.nurkkala at nokia.com>
---
sound/soc/soc-dapm.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index f79711b..d6fb6c4 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -349,6 +349,7 @@ static int dapm_set_pga(struct snd_soc_dapm_widget *widget, int power)
unsigned int mask = (1 << fls(max)) - 1;
unsigned int invert = mc->invert;
+ mutex_lock(&widget->codec->mutex);
if (power) {
int i;
/* power up has happended, increase volume to last level */
@@ -373,6 +374,7 @@ static int dapm_set_pga(struct snd_soc_dapm_widget *widget, int power)
}
widget->muted = 1;
}
+ mutex_unlock(&widget->codec->mutex);
}
return 0;
}
--
1.6.0.4
More information about the Alsa-devel
mailing list