Commit c26badfc authored by Takashi Iwai's avatar Takashi Iwai Committed by Ben Hutchings

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

commit 902eb7fd upstream.

Just a minor code cleanup: unify the error paths.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 12ecd2fa
......@@ -153,22 +153,17 @@ static int create_fixed_stream_quirk(struct snd_usb_audio *chip,
stream = (fp->endpoint & USB_DIR_IN)
? SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK;
err = snd_usb_add_audio_stream(chip, stream, fp);
if (err < 0) {
kfree(fp);
kfree(rate_table);
return err;
}
if (err < 0)
goto error;
if (fp->iface != get_iface_desc(&iface->altsetting[0])->bInterfaceNumber ||
fp->altset_idx >= iface->num_altsetting) {
kfree(fp);
kfree(rate_table);
return -EINVAL;
err = -EINVAL;
goto error;
}
alts = &iface->altsetting[fp->altset_idx];
if (get_iface_desc(alts)->bNumEndpoints < 1) {
kfree(fp);
kfree(rate_table);
return -EINVAL;
err = -EINVAL;
goto error;
}
fp->datainterval = snd_usb_parse_datainterval(chip, alts);
......@@ -177,6 +172,11 @@ static int create_fixed_stream_quirk(struct snd_usb_audio *chip,
snd_usb_init_pitch(chip, fp->iface, alts, fp);
snd_usb_init_sample_rate(chip, fp->iface, alts, fp, fp->rate_max);
return 0;
error:
kfree(fp);
kfree(rate_table);
return err;
}
/*
......
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