From: Takashi Iwai Subject: Re: [PATCH 2/2] ALSA: usb: handle descriptor with SYNC_NONE illegal value Date: Fri, 14 Aug 2015 18:03:55 +0200 Message-ID: References: <1439505753-3532-1-git-send-email-pierre-louis.bossart@linux.intel.com> <1439505753-3532-3-git-send-email-pierre-louis.bossart@linux.intel.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 (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id BEF37265979 for ; Fri, 14 Aug 2015 18:03:57 +0200 (CEST) In-Reply-To: <1439505753-3532-3-git-send-email-pierre-louis.bossart@linux.intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Pierre-Louis Bossart Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org On Fri, 14 Aug 2015 00:42:33 +0200, Pierre-Louis Bossart wrote: > --- a/sound/usb/pcm.c > +++ b/sound/usb/pcm.c > @@ -411,10 +411,17 @@ static int set_sync_endpoint(struct snd_usb_substream *subs, > if (altsd->bNumEndpoints < 2) > return 0; > > - if ((is_playback && attr != USB_ENDPOINT_SYNC_ASYNC) || > + if ((is_playback && attr == USB_ENDPOINT_SYNC_SYNC) || > + (is_playback && attr == USB_ENDPOINT_SYNC_ADAPTIVE) || Better to be: (is_playback && (attr == USB_ENDPOINT_SYNC_SYNC || attr == USB_ENDPOINT_SYNC_ADAPTIVE)) || > (!is_playback && attr != USB_ENDPOINT_SYNC_ADAPTIVE)) > return 0; > > + /* > + * In case of illegal SYNC_NONE for OUT endpoint, we keep going to see > + * if we don't find a sync endpoint, as on M-Audio Transit. In case of > + * error fall back to SYNC mode and don't create sync endpoint > + */ > + > /* check sync-pipe endpoint */ > /* ... and check descriptor size before accessing bSynchAddress > because there is a version of the SB Audigy 2 NX firmware lacking > @@ -428,6 +435,8 @@ static int set_sync_endpoint(struct snd_usb_substream *subs, > get_endpoint(alts, 1)->bmAttributes, > get_endpoint(alts, 1)->bLength, > get_endpoint(alts, 1)->bSynchAddress); > + if (is_playback && attr == USB_ENDPOINT_SYNC_NONE) > + goto no_valid_sync_ep_found; We handle this as a success case, so the error message should be avoided for SYNC_NONE. Also, it's fine just returning 0 here. > return -EINVAL; > } > ep = get_endpoint(alts, 1)->bEndpointAddress; > @@ -438,6 +447,8 @@ static int set_sync_endpoint(struct snd_usb_substream *subs, > "%d:%d : invalid sync pipe. is_playback %d, ep %02x, bSynchAddress %02x\n", > fmt->iface, fmt->altsetting, > is_playback, ep, get_endpoint(alts, 0)->bSynchAddress); > + if (is_playback && attr == USB_ENDPOINT_SYNC_NONE) > + goto no_valid_sync_ep_found; Ditto. thanks, Takashi