All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: Use codec mutex in dapm_set_pga()
@ 2009-10-01  6:17 ext-eero.nurkkala
  2009-10-01 10:37 ` Mark Brown
  0 siblings, 1 reply; 8+ messages in thread
From: ext-eero.nurkkala @ 2009-10-01  6:17 UTC (permalink / raw)
  To: alsa-devel; +Cc: broonie, Eero Nurkkala

From: Eero Nurkkala <ext-eero.nurkkala@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@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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-10-01 12:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-01  6:17 [PATCH] ASoC: Use codec mutex in dapm_set_pga() ext-eero.nurkkala
2009-10-01 10:37 ` Mark Brown
2009-10-01 11:01   ` Eero Nurkkala
2009-10-01 11:56     ` Eero Nurkkala
2009-10-01 12:09       ` Mark Brown
2009-10-01 12:34         ` Eero Nurkkala
2009-10-01 12:45           ` Mark Brown
2009-10-01 12:08     ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.