[alsa-devel] [PATCH] ASoC: OMAP machines: Fix kernel crash due to changes in core
Peter Ujfalusi
peter.ujfalusi at ti.com
Fri Oct 7 09:06:46 CEST 2011
Calling soc_dapm_sync() after adding DAPM widgets/routes
will lead to kernel crash caused by unitialized
widget->power_check callback (NULL pointer dereference).
Call snd_soc_dapm_new_widgets(dapm); instead of soc_dapm_sync
which will initialize the widgets, and will call the
dapm_power_widgets (soc_dapm_sync is a wrapper for
dapm_power_widgets).
Signed-off-by: Peter Ujfalusi <peter.ujfalusi at ti.com>
Cc: Anuj Aggarwal <anuj.aggarwal at ti.com>
Cc: Janusz Krzysztofik <jkrzyszt at tis.icnet.pl>
Cc: Jarkko Nikula <jarkko.nikula at bitmer.com>
Cc: Gražvydas Ignotas <notasas at gmail.com>
Cc: Misael Lopez Cruz <misael.lopez at ti.com>
---
sound/soc/omap/am3517evm.c | 2 +-
sound/soc/omap/ams-delta.c | 2 +-
sound/soc/omap/n810.c | 2 +-
sound/soc/omap/omap3pandora.c | 4 ++--
sound/soc/omap/osk5912.c | 2 +-
sound/soc/omap/rx51.c | 9 ++++++---
sound/soc/omap/sdp3430.c | 2 +-
sound/soc/omap/sdp4430.c | 2 +-
sound/soc/omap/zoom2.c | 2 +-
9 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/sound/soc/omap/am3517evm.c b/sound/soc/omap/am3517evm.c
index 48af0f8..f9b995f 100644
--- a/sound/soc/omap/am3517evm.c
+++ b/sound/soc/omap/am3517evm.c
@@ -107,7 +107,7 @@ static int am3517evm_aic23_init(struct snd_soc_pcm_runtime *rtd)
snd_soc_dapm_enable_pin(dapm, "Line In");
snd_soc_dapm_enable_pin(dapm, "Mic In");
- snd_soc_dapm_sync(dapm);
+ snd_soc_dapm_new_widgets(dapm);
return 0;
}
diff --git a/sound/soc/omap/ams-delta.c b/sound/soc/omap/ams-delta.c
index 0aa475f..10d3d41 100644
--- a/sound/soc/omap/ams-delta.c
+++ b/sound/soc/omap/ams-delta.c
@@ -569,7 +569,7 @@ static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd)
snd_soc_dapm_disable_pin(dapm, "Speaker");
snd_soc_dapm_disable_pin(dapm, "AGCIN");
snd_soc_dapm_disable_pin(dapm, "AGCOUT");
- snd_soc_dapm_sync(dapm);
+ snd_soc_dapm_new_widgets(dapm);
/* Add virtual switch */
ret = snd_soc_add_controls(codec, ams_delta_audio_controls,
diff --git a/sound/soc/omap/n810.c b/sound/soc/omap/n810.c
index c10d356..bda2aa4 100644
--- a/sound/soc/omap/n810.c
+++ b/sound/soc/omap/n810.c
@@ -282,7 +282,7 @@ static int n810_aic33_init(struct snd_soc_pcm_runtime *rtd)
/* Set up N810 specific audio path audio_map */
snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
- snd_soc_dapm_sync(dapm);
+ snd_soc_dapm_new_widgets(dapm);
return 0;
}
diff --git a/sound/soc/omap/omap3pandora.c b/sound/soc/omap/omap3pandora.c
index 3ae87fd..35368fa 100644
--- a/sound/soc/omap/omap3pandora.c
+++ b/sound/soc/omap/omap3pandora.c
@@ -176,7 +176,7 @@ static int omap3pandora_out_init(struct snd_soc_pcm_runtime *rtd)
snd_soc_dapm_add_routes(dapm, omap3pandora_out_map,
ARRAY_SIZE(omap3pandora_out_map));
- return snd_soc_dapm_sync(dapm);
+ return snd_soc_dapm_new_widgets(dapm);
}
static int omap3pandora_in_init(struct snd_soc_pcm_runtime *rtd)
@@ -199,7 +199,7 @@ static int omap3pandora_in_init(struct snd_soc_pcm_runtime *rtd)
snd_soc_dapm_add_routes(dapm, omap3pandora_in_map,
ARRAY_SIZE(omap3pandora_in_map));
- return snd_soc_dapm_sync(dapm);
+ return snd_soc_dapm_new_widgets(dapm);
}
static struct snd_soc_ops omap3pandora_ops = {
diff --git a/sound/soc/omap/osk5912.c b/sound/soc/omap/osk5912.c
index 5978332..4a13c45 100644
--- a/sound/soc/omap/osk5912.c
+++ b/sound/soc/omap/osk5912.c
@@ -107,7 +107,7 @@ static int osk_tlv320aic23_init(struct snd_soc_pcm_runtime *rtd)
snd_soc_dapm_enable_pin(dapm, "Line In");
snd_soc_dapm_enable_pin(dapm, "Mic Jack");
- snd_soc_dapm_sync(dapm);
+ snd_soc_dapm_new_widgets(dapm);
return 0;
}
diff --git a/sound/soc/omap/rx51.c b/sound/soc/omap/rx51.c
index 7164db5..a4676a0 100644
--- a/sound/soc/omap/rx51.c
+++ b/sound/soc/omap/rx51.c
@@ -317,7 +317,7 @@ static int rx51_aic34_init(struct snd_soc_pcm_runtime *rtd)
if (err < 0)
return err;
- snd_soc_dapm_sync(dapm);
+ snd_soc_dapm_new_widgets(dapm);
/* AV jack detection */
err = snd_soc_jack_new(codec, "AV Jack",
@@ -346,8 +346,11 @@ static int rx51_aic34b_init(struct snd_soc_dapm_context *dapm)
if (err < 0)
return 0;
- return snd_soc_dapm_add_routes(dapm, audio_mapb,
- ARRAY_SIZE(audio_mapb));
+ err = snd_soc_dapm_add_routes(dapm, audio_mapb, ARRAY_SIZE(audio_mapb));
+ if (err < 0)
+ return 0;
+
+ return snd_soc_dapm_new_widgets(dapm);
}
/* Digital audio interface glue - connects codec <--> CPU */
diff --git a/sound/soc/omap/sdp3430.c b/sound/soc/omap/sdp3430.c
index 269aded..4bb650f 100644
--- a/sound/soc/omap/sdp3430.c
+++ b/sound/soc/omap/sdp3430.c
@@ -159,7 +159,7 @@ static int sdp3430_twl4030_init(struct snd_soc_pcm_runtime *rtd)
snd_soc_dapm_nc_pin(dapm, "CARKITL");
snd_soc_dapm_nc_pin(dapm, "CARKITR");
- ret = snd_soc_dapm_sync(dapm);
+ ret = snd_soc_dapm_new_widgets(dapm);
if (ret)
return ret;
diff --git a/sound/soc/omap/sdp4430.c b/sound/soc/omap/sdp4430.c
index 79ec76d..10972fb 100644
--- a/sound/soc/omap/sdp4430.c
+++ b/sound/soc/omap/sdp4430.c
@@ -140,7 +140,7 @@ static int sdp4430_twl6040_init(struct snd_soc_pcm_runtime *rtd)
snd_soc_dapm_enable_pin(dapm, "Headset Mic");
snd_soc_dapm_enable_pin(dapm, "Headset Stereophone");
- ret = snd_soc_dapm_sync(dapm);
+ ret = snd_soc_dapm_new_widgets(dapm);
if (ret)
return ret;
diff --git a/sound/soc/omap/zoom2.c b/sound/soc/omap/zoom2.c
index 8b1ebbc..9e7d21d 100644
--- a/sound/soc/omap/zoom2.c
+++ b/sound/soc/omap/zoom2.c
@@ -126,7 +126,7 @@ static int zoom2_twl4030_init(struct snd_soc_pcm_runtime *rtd)
snd_soc_dapm_nc_pin(dapm, "CARKITL");
snd_soc_dapm_nc_pin(dapm, "CARKITR");
- ret = snd_soc_dapm_sync(dapm);
+ ret = snd_soc_dapm_new_widgets(dapm);
return ret;
}
--
1.7.7
More information about the Alsa-devel
mailing list