summaryrefslogtreecommitdiffstats
path: root/ALSA-usb-audio-Minor-code-cleanup-in-create_fixed_st.patch
diff options
context:
space:
mode:
Diffstat (limited to 'ALSA-usb-audio-Minor-code-cleanup-in-create_fixed_st.patch')
-rw-r--r--ALSA-usb-audio-Minor-code-cleanup-in-create_fixed_st.patch62
1 files changed, 62 insertions, 0 deletions
diff --git a/ALSA-usb-audio-Minor-code-cleanup-in-create_fixed_st.patch b/ALSA-usb-audio-Minor-code-cleanup-in-create_fixed_st.patch
new file mode 100644
index 000000000..65f88553b
--- /dev/null
+++ b/ALSA-usb-audio-Minor-code-cleanup-in-create_fixed_st.patch
@@ -0,0 +1,62 @@
+From aa6c68ed429ba354b904554d396326bfd9ab96bf Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Tue, 15 Mar 2016 12:14:49 +0100
+Subject: [PATCH 1/2] ALSA: usb-audio: Minor code cleanup in
+ create_fixed_stream_quirk()
+
+Just a minor code cleanup: unify the error paths.
+
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+---
+ sound/usb/quirks.c | 22 +++++++++++-----------
+ 1 file changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
+index f2e4eebdf76d..2f0bbc43f902 100644
+--- a/sound/usb/quirks.c
++++ b/sound/usb/quirks.c
+@@ -167,23 +167,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;
+@@ -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_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,
+--
+2.5.5
+