lkml.org 
[lkml]   [2013]   [Apr]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[ 030/171 ] ALSA: snd-usb: mixer: ignore -EINVAL in snd_usb_mixer_controls()
    3.6.11.2 stable review patch.
    If anyone has any objections, please let me know.

    ------------------

    From: Daniel Mack <zonque@gmail.com>

    [ Upstream commit 83ea5d18d74f032a760fecde78c0210f66f7f70c ]

    Creation of individual mixer controls may fail, but that shouldn't cause
    the entire mixer creation to fail. Even worse, if the mixer creation
    fails, that will error out the entire device probing.

    All the functions called by parse_audio_unit() should return -EINVAL if
    they find descriptors that are unsupported or believed to be malformed,
    so we can safely handle this error code as a non-fatal condition in
    snd_usb_mixer_controls().

    That fixes a long standing bug which is commonly worked around by
    adding quirks which make the driver ignore entire interfaces. Some of
    them might now be unnecessary.

    Signed-off-by: Daniel Mack <zonque@gmail.com>
    Reported-and-tested-by: Rodolfo Thomazelli <pe.soberbo@gmail.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
    ---
    sound/usb/mixer.c | 6 +++---
    1 file changed, 3 insertions(+), 3 deletions(-)

    diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
    index c20a0c5..900bf42 100644
    --- a/sound/usb/mixer.c
    +++ b/sound/usb/mixer.c
    @@ -2040,7 +2040,7 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer)
    state.oterm.type = le16_to_cpu(desc->wTerminalType);
    state.oterm.name = desc->iTerminal;
    err = parse_audio_unit(&state, desc->bSourceID);
    - if (err < 0)
    + if (err < 0 && err != -EINVAL)
    return err;
    } else { /* UAC_VERSION_2 */
    struct uac2_output_terminal_descriptor *desc = p;
    @@ -2052,12 +2052,12 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer)
    state.oterm.type = le16_to_cpu(desc->wTerminalType);
    state.oterm.name = desc->iTerminal;
    err = parse_audio_unit(&state, desc->bSourceID);
    - if (err < 0)
    + if (err < 0 && err != -EINVAL)
    return err;

    /* for UAC2, use the same approach to also add the clock selectors */
    err = parse_audio_unit(&state, desc->bCSourceID);
    - if (err < 0)
    + if (err < 0 && err != -EINVAL)
    return err;
    }
    }
    --
    1.7.10.4



    \
     
     \ /
      Last update: 2013-04-11 23:21    [W:4.484 / U:0.092 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site