Commit 902eb7fd authored by Takashi Iwai's avatar Takashi Iwai

ALSA: usb-audio: Minor code cleanup in create_fixed_stream_quirk()

Just a minor code cleanup: unify the error paths.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 0f886ca1
...@@ -167,23 +167,18 @@ static int create_fixed_stream_quirk(struct snd_usb_audio *chip, ...@@ -167,23 +167,18 @@ static int create_fixed_stream_quirk(struct snd_usb_audio *chip,
stream = (fp->endpoint & USB_DIR_IN) stream = (fp->endpoint & USB_DIR_IN)
? SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK; ? SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK;
err = snd_usb_add_audio_stream(chip, stream, fp); err = snd_usb_add_audio_stream(chip, stream, fp);
if (err < 0) { if (err < 0)
kfree(fp); goto error;
kfree(rate_table);
return err;
}
if (fp->iface != get_iface_desc(&iface->altsetting[0])->bInterfaceNumber || if (fp->iface != get_iface_desc(&iface->altsetting[0])->bInterfaceNumber ||
fp->altset_idx >= iface->num_altsetting) { fp->altset_idx >= iface->num_altsetting) {
kfree(fp); err = -EINVAL;
kfree(rate_table); goto error;
return -EINVAL;
} }
alts = &iface->altsetting[fp->altset_idx]; alts = &iface->altsetting[fp->altset_idx];
altsd = get_iface_desc(alts); altsd = get_iface_desc(alts);
if (altsd->bNumEndpoints < 1) { if (altsd->bNumEndpoints < 1) {
kfree(fp); err = -EINVAL;
kfree(rate_table); goto error;
return -EINVAL;
} }
fp->protocol = altsd->bInterfaceProtocol; fp->protocol = altsd->bInterfaceProtocol;
...@@ -196,6 +191,11 @@ static int create_fixed_stream_quirk(struct snd_usb_audio *chip, ...@@ -196,6 +191,11 @@ static int create_fixed_stream_quirk(struct snd_usb_audio *chip,
snd_usb_init_pitch(chip, fp->iface, alts, fp); snd_usb_init_pitch(chip, fp->iface, alts, fp);
snd_usb_init_sample_rate(chip, fp->iface, alts, fp, fp->rate_max); snd_usb_init_sample_rate(chip, fp->iface, alts, fp, fp->rate_max);
return 0; return 0;
error:
kfree(fp);
kfree(rate_table);
return err;
} }
static int create_auto_pcm_quirk(struct snd_usb_audio *chip, static int create_auto_pcm_quirk(struct snd_usb_audio *chip,
......
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