From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: [PATCH 2/5] ALSA: snd-usb: implement new endpoint streaming model Date: Tue, 20 Dec 2011 16:42:58 +0100 Message-ID: References: <1324374520-32332-1-git-send-email-zonque@gmail.com> <1324374520-32332-3-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 326F0103B55 for ; Tue, 20 Dec 2011 16:43:01 +0100 (CET) In-Reply-To: <1324374520-32332-3-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: blablack@gmail.com, alsa-devel@alsa-project.org, clemens@ladisch.de, gdiffey@gmail.com, linuxaudio@showlabor.de List-Id: alsa-devel@alsa-project.org At Tue, 20 Dec 2011 10:48:37 +0100, Daniel Mack wrote: > > @@ -99,7 +104,7 @@ static int deactivate_urbs(struct snd_usb_substream *subs, int force, int can_sl > */ > static void release_urb_ctx(struct snd_urb_ctx *u) > { > - if (u->urb) { > + if (!u || u->urb) { > if (u->buffer_size) This will lead to Oops when u == NULL, no? > +/* determine the number of frames in the next packet */ > +static int next_packet_size(struct snd_usb_endpoint *ep) > +{ > + unsigned long flags; > + > + if (ep->fill_max) > + return ep->maxframesize; > + > + spin_lock_irqsave(&ep->lock, flags); > + ep->phase = (ep->phase & 0xffff) > + + (ep->freqm << ep->datainterval); > + spin_unlock_irqrestore(&ep->lock, flags); > + > + return min(ep->phase >> 16, ep->maxframesize); If you need a protection here, safer to cover until min(), I guess. Takashi