diff mbox

ALSA: usb-audio: fix missing input volume controls in MAYA44 USB(+)

Message ID 556ECAB3.907@ladisch.de (mailing list archive)
State New, archived
Headers show

Commit Message

Clemens Ladisch June 3, 2015, 9:36 a.m. UTC
The driver worked around an error in the MAYA44 USB(+)'s mixer unit
descriptor by aborting before parsing the missing field.  However,
aborting parsing too early prevented parsing of the other units
connected to this unit, so the capture mixer controls would be missing.

Fix this by moving the check for this descriptor error after the parsing
of the unit's input pins.

Reported-by: nightmixes <nightmixes@gmail.com>
Tested-by: nightmixes <nightmixes@gmail.com>
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>

Comments

Takashi Iwai June 3, 2015, 12:02 p.m. UTC | #1
At Wed, 03 Jun 2015 11:36:51 +0200,
Clemens Ladisch wrote:
> 
> The driver worked around an error in the MAYA44 USB(+)'s mixer unit
> descriptor by aborting before parsing the missing field.  However,
> aborting parsing too early prevented parsing of the other units
> connected to this unit, so the capture mixer controls would be missing.
> 
> Fix this by moving the check for this descriptor error after the parsing
> of the unit's input pins.
> 
> Reported-by: nightmixes <nightmixes@gmail.com>
> Tested-by: nightmixes <nightmixes@gmail.com>
> Signed-off-by: Clemens Ladisch <clemens@ladisch.de>

Applied, thanks.


Takashi

> 
> --- a/sound/usb/mixer.c
> +++ b/sound/usb/mixer.c
> @@ -1583,18 +1583,15 @@ static int parse_audio_mixer_unit(struct
>  			      unitid);
>  		return -EINVAL;
>  	}
> -	/* no bmControls field (e.g. Maya44) -> ignore */
> -	if (desc->bLength <= 10 + input_pins) {
> -		usb_audio_dbg(state->chip, "MU %d has no bmControls field\n",
> -			      unitid);
> -		return 0;
> -	}
> 
>  	num_ins = 0;
>  	ich = 0;
>  	for (pin = 0; pin < input_pins; pin++) {
>  		err = parse_audio_unit(state, desc->baSourceID[pin]);
>  		if (err < 0)
> +			continue;
> +		/* no bmControls field (e.g. Maya44) -> ignore */
> +		if (desc->bLength <= 10 + input_pins)
>  			continue;
>  		err = check_input_term(state, desc->baSourceID[pin], &iterm);
>  		if (err < 0)
>
diff mbox

Patch

--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -1583,18 +1583,15 @@  static int parse_audio_mixer_unit(struct
 			      unitid);
 		return -EINVAL;
 	}
-	/* no bmControls field (e.g. Maya44) -> ignore */
-	if (desc->bLength <= 10 + input_pins) {
-		usb_audio_dbg(state->chip, "MU %d has no bmControls field\n",
-			      unitid);
-		return 0;
-	}

 	num_ins = 0;
 	ich = 0;
 	for (pin = 0; pin < input_pins; pin++) {
 		err = parse_audio_unit(state, desc->baSourceID[pin]);
 		if (err < 0)
+			continue;
+		/* no bmControls field (e.g. Maya44) -> ignore */
+		if (desc->bLength <= 10 + input_pins)
 			continue;
 		err = check_input_term(state, desc->baSourceID[pin], &iterm);
 		if (err < 0)