summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-02-17 17:28:13 +0100
committerTakashi Iwai <tiwai@suse.de>2009-02-17 17:28:13 +0100
commita8b557b30242002af6189a587d57fb40f11dda95 (patch)
tree8e00bb6a56b2c31f5f704ca03d4537242aec9c1d
parent0b7044418c81b751d9f059fbfcade470a7d5c882 (diff)
pulse: Add numid check in ctl plugin
Added the check of non-zero numid and optimize the look-up for the element. Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--pulse/ctl_pulse.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/pulse/ctl_pulse.c b/pulse/ctl_pulse.c
index 8a5546c..c6cf9e2 100644
--- a/pulse/ctl_pulse.c
+++ b/pulse/ctl_pulse.c
@@ -229,6 +229,11 @@ static snd_ctl_ext_key_t pulse_find_elem(snd_ctl_ext_t * ext,
const snd_ctl_elem_id_t * id)
{
const char *name;
+ unsigned int numid;
+
+ numid = snd_ctl_elem_id_get_numid(id);
+ if (numid > 0 && numid <= 4)
+ return numid - 1;
name = snd_ctl_elem_id_get_name(id);