Skip to content

Commit

Permalink
ALSA: usb-audio: Recurse before saving terminal properties
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Daniel Mack <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
julianscheel authored and tiwai committed Aug 19, 2015
1 parent d5cf00c commit 9430e54
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions sound/usb/mixer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down

0 comments on commit 9430e54

Please sign in to comment.