diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2011-06-09 07:22:36 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-06-09 10:06:54 -0400 |
commit | 4b80b8c2eee5282dab57f094fd3893c0c09f750c (patch) | |
tree | 233898690a53e59335f2ebd3fda38845cabb911d /sound | |
parent | 0cd114fff9ace7014c0d3ef8ab385fc5d3cf2d2f (diff) |
ASoC: snd_soc_new_{mixer,mux,pga} make sure to use right DAPM context
Currently it is possible that snd_soc_new_{mixer,mux,pga} is called with a
DAPM context not matching the widgets context. This can lead to a wrong
prefix_len calculation, which will result in undefined behaviour. To avoid
this always use the DAPM context from the widget itself.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@kernel.org
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/soc-dapm.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 776e6f418306..32ab7fc4579a 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -350,9 +350,9 @@ static int dapm_is_shared_kcontrol(struct snd_soc_dapm_context *dapm, | |||
350 | } | 350 | } |
351 | 351 | ||
352 | /* create new dapm mixer control */ | 352 | /* create new dapm mixer control */ |
353 | static int dapm_new_mixer(struct snd_soc_dapm_context *dapm, | 353 | static int dapm_new_mixer(struct snd_soc_dapm_widget *w) |
354 | struct snd_soc_dapm_widget *w) | ||
355 | { | 354 | { |
355 | struct snd_soc_dapm_context *dapm = w->dapm; | ||
356 | int i, ret = 0; | 356 | int i, ret = 0; |
357 | size_t name_len, prefix_len; | 357 | size_t name_len, prefix_len; |
358 | struct snd_soc_dapm_path *path; | 358 | struct snd_soc_dapm_path *path; |
@@ -450,9 +450,9 @@ static int dapm_new_mixer(struct snd_soc_dapm_context *dapm, | |||
450 | } | 450 | } |
451 | 451 | ||
452 | /* create new dapm mux control */ | 452 | /* create new dapm mux control */ |
453 | static int dapm_new_mux(struct snd_soc_dapm_context *dapm, | 453 | static int dapm_new_mux(struct snd_soc_dapm_widget *w) |
454 | struct snd_soc_dapm_widget *w) | ||
455 | { | 454 | { |
455 | struct snd_soc_dapm_context *dapm = w->dapm; | ||
456 | struct snd_soc_dapm_path *path = NULL; | 456 | struct snd_soc_dapm_path *path = NULL; |
457 | struct snd_kcontrol *kcontrol; | 457 | struct snd_kcontrol *kcontrol; |
458 | struct snd_card *card = dapm->card->snd_card; | 458 | struct snd_card *card = dapm->card->snd_card; |
@@ -535,8 +535,7 @@ static int dapm_new_mux(struct snd_soc_dapm_context *dapm, | |||
535 | } | 535 | } |
536 | 536 | ||
537 | /* create new dapm volume control */ | 537 | /* create new dapm volume control */ |
538 | static int dapm_new_pga(struct snd_soc_dapm_context *dapm, | 538 | static int dapm_new_pga(struct snd_soc_dapm_widget *w) |
539 | struct snd_soc_dapm_widget *w) | ||
540 | { | 539 | { |
541 | if (w->num_kcontrols) | 540 | if (w->num_kcontrols) |
542 | dev_err(w->dapm->dev, | 541 | dev_err(w->dapm->dev, |
@@ -1826,13 +1825,13 @@ int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm) | |||
1826 | case snd_soc_dapm_mixer: | 1825 | case snd_soc_dapm_mixer: |
1827 | case snd_soc_dapm_mixer_named_ctl: | 1826 | case snd_soc_dapm_mixer_named_ctl: |
1828 | w->power_check = dapm_generic_check_power; | 1827 | w->power_check = dapm_generic_check_power; |
1829 | dapm_new_mixer(dapm, w); | 1828 | dapm_new_mixer(w); |
1830 | break; | 1829 | break; |
1831 | case snd_soc_dapm_mux: | 1830 | case snd_soc_dapm_mux: |
1832 | case snd_soc_dapm_virt_mux: | 1831 | case snd_soc_dapm_virt_mux: |
1833 | case snd_soc_dapm_value_mux: | 1832 | case snd_soc_dapm_value_mux: |
1834 | w->power_check = dapm_generic_check_power; | 1833 | w->power_check = dapm_generic_check_power; |
1835 | dapm_new_mux(dapm, w); | 1834 | dapm_new_mux(w); |
1836 | break; | 1835 | break; |
1837 | case snd_soc_dapm_adc: | 1836 | case snd_soc_dapm_adc: |
1838 | case snd_soc_dapm_aif_out: | 1837 | case snd_soc_dapm_aif_out: |
@@ -1845,7 +1844,7 @@ int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm) | |||
1845 | case snd_soc_dapm_pga: | 1844 | case snd_soc_dapm_pga: |
1846 | case snd_soc_dapm_out_drv: | 1845 | case snd_soc_dapm_out_drv: |
1847 | w->power_check = dapm_generic_check_power; | 1846 | w->power_check = dapm_generic_check_power; |
1848 | dapm_new_pga(dapm, w); | 1847 | dapm_new_pga(w); |
1849 | break; | 1848 | break; |
1850 | case snd_soc_dapm_input: | 1849 | case snd_soc_dapm_input: |
1851 | case snd_soc_dapm_output: | 1850 | case snd_soc_dapm_output: |