From: Takashi Iwai Subject: Re: [PATCH 1/5] ALSA: snd-usb: don't fail hard if mixer creation fails Date: Wed, 13 Jul 2011 07:29:13 +0200 Message-ID: References: <1310516009-4387-1-git-send-email-zonque@gmail.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 5AF041038BD for ; Wed, 13 Jul 2011 07:29:16 +0200 (CEST) In-Reply-To: <1310516009-4387-1-git-send-email-zonque@gmail.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: Daniel Mack Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org At Wed, 13 Jul 2011 02:13:25 +0200, Daniel Mack wrote: > > There are cards that the mixer code fails to create controls for, and > currently, the whole sound device creation fails in such cases. This > patch changes the code so that it just spits out warnings and continues > looking at other functions of the descriptor set which might work just > fine. It depends. If a serious error like -ENOMEM, we should abort immediately. It means something is really bad. > The worst thing that can happen now is that people see soundcards that > don't have all funcions supported, but rejecting the whole device is > not any better. Then it'd be better to check some "easy" errors to be ignored (or check serious errors to abort). I don't like ignoring all errors blindly. thanks, Takashi > > Signed-off-by: Daniel Mack > --- > sound/usb/card.c | 5 ++--- > sound/usb/mixer.c | 9 ++++++--- > 2 files changed, 8 insertions(+), 6 deletions(-) > > diff --git a/sound/usb/card.c b/sound/usb/card.c > index 220c616..8990b49 100644 > --- a/sound/usb/card.c > +++ b/sound/usb/card.c > @@ -512,9 +512,8 @@ static void *snd_usb_audio_probe(struct usb_device *dev, > if (err > 0) { > /* create normal USB audio interfaces */ > if (snd_usb_create_streams(chip, ifnum) < 0 || > - snd_usb_create_mixer(chip, ifnum, ignore_ctl_error) < 0) { > - goto __error; > - } > + snd_usb_create_mixer(chip, ifnum, ignore_ctl_error) < 0) > + snd_printk(KERN_WARNING "snd_usb_create_mixer() failed\n"); > } > > /* we are allowed to call snd_card_register() many times */ > diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c > index c22fa76..c43dbea 100644 > --- a/sound/usb/mixer.c > +++ b/sound/usb/mixer.c > @@ -1967,7 +1967,8 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer) > state.oterm.name = desc->iTerminal; > err = parse_audio_unit(&state, desc->bSourceID); > if (err < 0) > - return err; > + snd_printk(KERN_WARNING "Unable to parse terminal with bSourceID %d\n", > + desc->bSourceID); > } else { /* UAC_VERSION_2 */ > struct uac2_output_terminal_descriptor *desc = p; > > @@ -1979,12 +1980,14 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer) > state.oterm.name = desc->iTerminal; > err = parse_audio_unit(&state, desc->bSourceID); > if (err < 0) > - return err; > + snd_printk(KERN_WARNING "Unable to parse terminal with bSourceID %d\n", > + desc->bSourceID); > > /* for UAC2, use the same approach to also add the clock selectors */ > err = parse_audio_unit(&state, desc->bCSourceID); > if (err < 0) > - return err; > + snd_printk(KERN_WARNING "Unable to parse clock terminal with bCSourceID %d\n", > + desc->bCSourceID); > } > } > > -- > 1.7.5.4 > > _______________________________________________ > Alsa-devel mailing list > Alsa-devel@alsa-project.org > http://mailman.alsa-project.org/mailman/listinfo/alsa-devel >