diff options
author | Takashi Iwai <tiwai@suse.de> | 2016-03-15 12:14:49 +0100 |
---|---|---|
committer | Simon Shields <keepcalm444@gmail.com> | 2016-11-11 13:26:51 +1100 |
commit | 60117f1016086f658c7d765a7f928e217699dbc4 (patch) | |
tree | 87045fee31cf2b80038ec6563c2c1e9db80847af | |
parent | 264a926b060fb244459a5e9feb0f0a60c3a559f5 (diff) | |
download | kernel_samsung_smdk4412-60117f1016086f658c7d765a7f928e217699dbc4.zip kernel_samsung_smdk4412-60117f1016086f658c7d765a7f928e217699dbc4.tar.gz kernel_samsung_smdk4412-60117f1016086f658c7d765a7f928e217699dbc4.tar.bz2 |
ALSA: usb-audio: Minor code cleanup in create_fixed_stream_quirk()
commit 902eb7fd1e4af3ac69b9b30f8373f118c92b9729 upstream.
Just a minor code cleanup: unify the error paths.
Change-Id: Idbac50c4d1602ea3b075c747a716cc6eab905b52
Signed-off-by: Takashi Iwai <tiwai@suse.de>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r-- | sound/usb/quirks.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index 62b955b..39e5c77 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c @@ -152,22 +152,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_endpoint(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); @@ -176,6 +171,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; } /* |