[alsa-devel] [PATCH 2/5] ALSA: snd-usb: implement new endpoint streaming model

Takashi Iwai tiwai at suse.de
Tue Dec 20 16:42:58 CET 2011


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


More information about the Alsa-devel mailing list