* [PATCH] ASoC: snd_soc_new_{mixer,mux,pga} make sure to use right DAPM context
@ 2011-06-09 11:22 ` Lars-Peter Clausen
0 siblings, 0 replies; 6+ messages in thread
From: Lars-Peter Clausen @ 2011-06-09 11:22 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood
Cc: alsa-devel, linux-kernel, Lars-Peter Clausen, stable
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>
Cc: stable@kernel.org
---
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 34106bc..fd2d774 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -337,9 +337,9 @@ static int dapm_is_shared_kcontrol(struct snd_soc_dapm_context *dapm,
}
/* create new dapm mixer control */
-static int dapm_new_mixer(struct snd_soc_dapm_context *dapm,
- struct snd_soc_dapm_widget *w)
+static int dapm_new_mixer(struct snd_soc_dapm_widget *w)
{
+ struct snd_soc_dapm_context *dapm = w->dapm;
int i, ret = 0;
size_t name_len, prefix_len;
struct snd_soc_dapm_path *path;
@@ -437,9 +437,9 @@ static int dapm_new_mixer(struct snd_soc_dapm_context *dapm,
}
/* create new dapm mux control */
-static int dapm_new_mux(struct snd_soc_dapm_context *dapm,
- struct snd_soc_dapm_widget *w)
+static int dapm_new_mux(struct snd_soc_dapm_widget *w)
{
+ struct snd_soc_dapm_context *dapm = w->dapm;
struct snd_soc_dapm_path *path = NULL;
struct snd_kcontrol *kcontrol;
struct snd_card *card = dapm->card->snd_card;
@@ -522,8 +522,7 @@ static int dapm_new_mux(struct snd_soc_dapm_context *dapm,
}
/* create new dapm volume control */
-static int dapm_new_pga(struct snd_soc_dapm_context *dapm,
- struct snd_soc_dapm_widget *w)
+static int dapm_new_pga(struct snd_soc_dapm_widget *w)
{
if (w->num_kcontrols)
dev_err(w->dapm->dev,
@@ -1838,13 +1837,13 @@ int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm)
case snd_soc_dapm_mixer:
case snd_soc_dapm_mixer_named_ctl:
w->power_check = dapm_generic_check_power;
- dapm_new_mixer(dapm, w);
+ dapm_new_mixer(w);
break;
case snd_soc_dapm_mux:
case snd_soc_dapm_virt_mux:
case snd_soc_dapm_value_mux:
w->power_check = dapm_generic_check_power;
- dapm_new_mux(dapm, w);
+ dapm_new_mux(w);
break;
case snd_soc_dapm_adc:
case snd_soc_dapm_aif_out:
@@ -1857,7 +1856,7 @@ int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm)
case snd_soc_dapm_pga:
case snd_soc_dapm_out_drv:
w->power_check = dapm_generic_check_power;
- dapm_new_pga(dapm, w);
+ dapm_new_pga(w);
break;
case snd_soc_dapm_input:
case snd_soc_dapm_output:
--
1.7.2.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] ASoC: snd_soc_new_{mixer, mux, pga} make sure to use right DAPM context
@ 2011-06-09 11:22 ` Lars-Peter Clausen
0 siblings, 0 replies; 6+ messages in thread
From: Lars-Peter Clausen @ 2011-06-09 11:22 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood
Cc: alsa-devel, Lars-Peter Clausen, linux-kernel, stable
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>
Cc: stable@kernel.org
---
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 34106bc..fd2d774 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -337,9 +337,9 @@ static int dapm_is_shared_kcontrol(struct snd_soc_dapm_context *dapm,
}
/* create new dapm mixer control */
-static int dapm_new_mixer(struct snd_soc_dapm_context *dapm,
- struct snd_soc_dapm_widget *w)
+static int dapm_new_mixer(struct snd_soc_dapm_widget *w)
{
+ struct snd_soc_dapm_context *dapm = w->dapm;
int i, ret = 0;
size_t name_len, prefix_len;
struct snd_soc_dapm_path *path;
@@ -437,9 +437,9 @@ static int dapm_new_mixer(struct snd_soc_dapm_context *dapm,
}
/* create new dapm mux control */
-static int dapm_new_mux(struct snd_soc_dapm_context *dapm,
- struct snd_soc_dapm_widget *w)
+static int dapm_new_mux(struct snd_soc_dapm_widget *w)
{
+ struct snd_soc_dapm_context *dapm = w->dapm;
struct snd_soc_dapm_path *path = NULL;
struct snd_kcontrol *kcontrol;
struct snd_card *card = dapm->card->snd_card;
@@ -522,8 +522,7 @@ static int dapm_new_mux(struct snd_soc_dapm_context *dapm,
}
/* create new dapm volume control */
-static int dapm_new_pga(struct snd_soc_dapm_context *dapm,
- struct snd_soc_dapm_widget *w)
+static int dapm_new_pga(struct snd_soc_dapm_widget *w)
{
if (w->num_kcontrols)
dev_err(w->dapm->dev,
@@ -1838,13 +1837,13 @@ int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm)
case snd_soc_dapm_mixer:
case snd_soc_dapm_mixer_named_ctl:
w->power_check = dapm_generic_check_power;
- dapm_new_mixer(dapm, w);
+ dapm_new_mixer(w);
break;
case snd_soc_dapm_mux:
case snd_soc_dapm_virt_mux:
case snd_soc_dapm_value_mux:
w->power_check = dapm_generic_check_power;
- dapm_new_mux(dapm, w);
+ dapm_new_mux(w);
break;
case snd_soc_dapm_adc:
case snd_soc_dapm_aif_out:
@@ -1857,7 +1856,7 @@ int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm)
case snd_soc_dapm_pga:
case snd_soc_dapm_out_drv:
w->power_check = dapm_generic_check_power;
- dapm_new_pga(dapm, w);
+ dapm_new_pga(w);
break;
case snd_soc_dapm_input:
case snd_soc_dapm_output:
--
1.7.2.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] ASoC: snd_soc_new_{mixer,mux,pga} make sure to use right DAPM context
2011-06-09 11:22 ` [PATCH] ASoC: snd_soc_new_{mixer, mux, pga} " Lars-Peter Clausen
@ 2011-06-09 13:56 ` Liam Girdwood
-1 siblings, 0 replies; 6+ messages in thread
From: Liam Girdwood @ 2011-06-09 13:56 UTC (permalink / raw)
To: Lars-Peter Clausen; +Cc: Mark Brown, alsa-devel, linux-kernel, stable
On 09/06/11 12:22, Lars-Peter Clausen wrote:
> 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>
> Cc: stable@kernel.org
>
Acked-by: Liam Girdwood <lrg@ti.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ASoC: snd_soc_new_{mixer, mux, pga} make sure to use right DAPM context
@ 2011-06-09 13:56 ` Liam Girdwood
0 siblings, 0 replies; 6+ messages in thread
From: Liam Girdwood @ 2011-06-09 13:56 UTC (permalink / raw)
To: Lars-Peter Clausen; +Cc: alsa-devel, Mark Brown, linux-kernel, stable
On 09/06/11 12:22, Lars-Peter Clausen wrote:
> 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>
> Cc: stable@kernel.org
>
Acked-by: Liam Girdwood <lrg@ti.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ASoC: snd_soc_new_{mixer,mux,pga} make sure to use right DAPM context
2011-06-09 11:22 ` [PATCH] ASoC: snd_soc_new_{mixer, mux, pga} " Lars-Peter Clausen
@ 2011-06-09 14:08 ` Mark Brown
-1 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2011-06-09 14:08 UTC (permalink / raw)
To: Lars-Peter Clausen; +Cc: Liam Girdwood, alsa-devel, linux-kernel, stable
On Thu, Jun 09, 2011 at 01:22:36PM +0200, Lars-Peter Clausen wrote:
> 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.
Applied, thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ASoC: snd_soc_new_{mixer, mux, pga} make sure to use right DAPM context
@ 2011-06-09 14:08 ` Mark Brown
0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2011-06-09 14:08 UTC (permalink / raw)
To: Lars-Peter Clausen; +Cc: stable, alsa-devel, Liam Girdwood, linux-kernel
On Thu, Jun 09, 2011 at 01:22:36PM +0200, Lars-Peter Clausen wrote:
> 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.
Applied, thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-06-09 14:08 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-09 11:22 [PATCH] ASoC: snd_soc_new_{mixer,mux,pga} make sure to use right DAPM context Lars-Peter Clausen
2011-06-09 11:22 ` [PATCH] ASoC: snd_soc_new_{mixer, mux, pga} " Lars-Peter Clausen
2011-06-09 13:56 ` [PATCH] ASoC: snd_soc_new_{mixer,mux,pga} " Liam Girdwood
2011-06-09 13:56 ` [PATCH] ASoC: snd_soc_new_{mixer, mux, pga} " Liam Girdwood
2011-06-09 14:08 ` [PATCH] ASoC: snd_soc_new_{mixer,mux,pga} " Mark Brown
2011-06-09 14:08 ` [PATCH] ASoC: snd_soc_new_{mixer, mux, pga} " 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.