summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTanu Kaskinen <tanu.kaskinen@linux.intel.com>2015-02-07 00:15:34 +0200
committerTanu Kaskinen <tanu.kaskinen@linux.intel.com>2015-02-12 15:06:59 +0200
commit82ec47898e77dca94a7d73e976363f745081d828 (patch)
treeaa24fd3946858b5a5336780789f5e0d4bd533d56
parentff5e7b8707ef7758d8e4a73885694777af743835 (diff)
alsa: Don't try to use ELD controls with UCM
This fixes a crash that occurred when trying to access non-existent port data. Doing this: pa_alsa_port_data *data = PA_DEVICE_PORT_DATA(port); is not a good idea when using UCM, because in the UCM mode ports don't have any data, so the data pointer points to some random memory.
-rw-r--r--src/modules/alsa/module-alsa-card.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/modules/alsa/module-alsa-card.c b/src/modules/alsa/module-alsa-card.c
index df041553c..a7fec048a 100644
--- a/src/modules/alsa/module-alsa-card.c
+++ b/src/modules/alsa/module-alsa-card.c
@@ -455,6 +455,12 @@ static void init_eld_ctls(struct userdata *u) {
if (!u->mixer_handle)
return;
+ /* The code in this function expects ports to have a pa_alsa_port_data
+ * struct as their data, but in UCM mode ports don't have any data. Hence,
+ * the ELD controls can't currently be used in UCM mode. */
+ if (u->use_ucm)
+ return;
+
PA_HASHMAP_FOREACH(port, u->card->ports, state) {
pa_alsa_port_data *data = PA_DEVICE_PORT_DATA(port);
snd_mixer_elem_t* melem;