Commit 9e9b5946 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: usb-audio: Fix the first PCM interface assignment

In the new PCM streaming logic, the interface number is assigned to
usb stream instance (subs->interface) after the format and rate setups
are succeeded, but some codes are still passing subs->interface as the
reference to helper functions.  This leads to initializing with an
invalid iface number (-1).

This patch replaces the wrong references with the ones from the target
fmt correctly.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 8663ff75
...@@ -387,7 +387,7 @@ static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt) ...@@ -387,7 +387,7 @@ static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt)
subs->data_endpoint->sync_master = subs->sync_endpoint; subs->data_endpoint->sync_master = subs->sync_endpoint;
} }
if ((err = snd_usb_init_pitch(subs->stream->chip, subs->interface, alts, fmt)) < 0) if ((err = snd_usb_init_pitch(subs->stream->chip, fmt->iface, alts, fmt)) < 0)
return err; return err;
subs->cur_audiofmt = fmt; subs->cur_audiofmt = fmt;
...@@ -450,7 +450,7 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream, ...@@ -450,7 +450,7 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream,
struct usb_interface *iface; struct usb_interface *iface;
iface = usb_ifnum_to_if(subs->dev, fmt->iface); iface = usb_ifnum_to_if(subs->dev, fmt->iface);
alts = &iface->altsetting[fmt->altset_idx]; alts = &iface->altsetting[fmt->altset_idx];
ret = snd_usb_init_sample_rate(subs->stream->chip, subs->interface, alts, fmt, rate); ret = snd_usb_init_sample_rate(subs->stream->chip, fmt->iface, alts, fmt, rate);
if (ret < 0) if (ret < 0)
return ret; return ret;
subs->cur_rate = rate; subs->cur_rate = rate;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment