diff options
| author | Takashi Iwai <tiwai@suse.de> | 2016-03-15 12:14:49 +0100 |
|---|---|---|
| committer | Moyster <oysterized@gmail.com> | 2016-11-17 12:13:09 +0100 |
| commit | aa2bf4d5a1b72343be67623aadc462fba16d3184 (patch) | |
| tree | 3b483404d02b2539d08ca0be3798018ef77f246c | |
| parent | de6c3107fc221fe13e8f1f39d2be9b06e017653d (diff) | |
ALSA: usb-audio: Minor code cleanup in create_fixed_stream_quirk()
Just a minor code cleanup: unify the error paths.
Issue: CYNGNOS-3304
Change-Id: I31346b08ed1024819c58eff797c63bb42c283512
Signed-off-by: Takashi Iwai <tiwai@suse.de>
| -rw-r--r-- | sound/usb/quirks.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index 44550a4cf..7db8f4fa4 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c @@ -153,16 +153,12 @@ 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 (fp->datainterval == 0) @@ -173,6 +169,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; } /* |
