[PATCH] ASoC: Use codec mutex in dapm_set_pga()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Eero Nurkkala <ext-eero.nurkkala@xxxxxxxxx>

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@xxxxxxxxx>
---
 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

_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux