summaryrefslogtreecommitdiffstats
path: root/sound/usb
diff options
context:
space:
mode:
authorJulian Scheel <julian@jusst.de>2015-08-19 09:28:09 +0200
committerTakashi Iwai <tiwai@suse.de>2015-08-19 18:05:13 +0200
commit9430e547894d2ff099e5717050eb40c1e1dd2bad (patch)
treedf2857431833a357b7ba9843f89f520dfca6276f /sound/usb
parentd5cf00c7ac2bf6b9d10c393b1e3b7551176c7f40 (diff)
downloadlinux-9430e547894d2ff099e5717050eb40c1e1dd2bad.tar.gz
linux-9430e547894d2ff099e5717050eb40c1e1dd2bad.tar.bz2
linux-9430e547894d2ff099e5717050eb40c1e1dd2bad.zip
ALSA: usb-audio: Recurse before saving terminal properties
The input terminal parser recurses into the referenced clock entity to verify it is existant and thus the terminal descriptor is valid. The actual property values of the term instance which is initially parsed must not be overriden by the recursion. For this to work the term properties have to be assigned after recursing into the referenced clock entity descriptors. Signed-off-by: Julian Scheel <julian@jusst.de> Acked-by: Daniel Mack <daniel@zonque.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb')
-rw-r--r--sound/usb/mixer.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index 81055d37af75..c50790cb3f4d 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -731,15 +731,21 @@ static int check_input_term(struct mixer_build *state, int id,
term->name = d->iTerminal;
} else { /* UAC_VERSION_2 */
struct uac2_input_terminal_descriptor *d = p1;
- term->type = le16_to_cpu(d->wTerminalType);
- term->channels = d->bNrChannels;
- term->chconfig = le32_to_cpu(d->bmChannelConfig);
- term->name = d->iTerminal;
- /* call recursively to get the clock selectors */
+ /* call recursively to verify that the
+ * referenced clock entity is valid */
err = check_input_term(state, d->bCSourceID, term);
if (err < 0)
return err;
+
+ /* save input term properties after recursion,
+ * to ensure they are not overriden by the
+ * recursion calls */
+ term->id = id;
+ term->type = le16_to_cpu(d->wTerminalType);
+ term->channels = d->bNrChannels;
+ term->chconfig = le32_to_cpu(d->bmChannelConfig);
+ term->name = d->iTerminal;
}
return 0;
case UAC_FEATURE_UNIT: {