summaryrefslogtreecommitdiffstats
path: root/sound/usb
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2016-03-15 12:14:49 +0100
committerSasha Levin <sasha.levin@oracle.com>2016-07-12 08:47:20 -0400
commit4aaf33222ca629d65ebd91a5b1755f66349d3626 (patch)
tree93aec1728012e94027fb56cc048e1114c7f72e4c /sound/usb
parent00f9443a3943ecd9c462cac3c5c27fc1af6a4f03 (diff)
downloadlinux-stable-4aaf33222ca629d65ebd91a5b1755f66349d3626.tar.gz
linux-stable-4aaf33222ca629d65ebd91a5b1755f66349d3626.tar.bz2
linux-stable-4aaf33222ca629d65ebd91a5b1755f66349d3626.zip
ALSA: usb-audio: Minor code cleanup in create_fixed_stream_quirk()
[ Upstream commit 902eb7fd1e4af3ac69b9b30f8373f118c92b9729 ] Just a minor code cleanup: unify the error paths. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Diffstat (limited to 'sound/usb')
-rw-r--r--sound/usb/quirks.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index 982c2df6d0b5..c6523eb7284e 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -155,23 +155,18 @@ 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];
altsd = get_iface_desc(alts);
if (altsd->bNumEndpoints < 1) {
- kfree(fp);
- kfree(rate_table);
- return -EINVAL;
+ err = -EINVAL;
+ goto error;
}
fp->protocol = altsd->bInterfaceProtocol;
@@ -184,6 +179,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;
}
static int create_auto_pcm_quirk(struct snd_usb_audio *chip,