summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorMarkus Elfring <elfring@users.sourceforge.net>2017-09-06 14:45:09 +0200
committerTakashi Iwai <tiwai@suse.de>2017-09-07 10:27:42 +0200
commit80753cdfef2a16a71d7c6b5aafe9700a2650913c (patch)
treec6f4aabb83c84c27c5cf196a6c8c90984b13036b /sound
parente35e9ddfab7e6017b38b8b75cd13756530b3b2b6 (diff)
downloadlinux-80753cdfef2a16a71d7c6b5aafe9700a2650913c.tar.gz
linux-80753cdfef2a16a71d7c6b5aafe9700a2650913c.tar.bz2
linux-80753cdfef2a16a71d7c6b5aafe9700a2650913c.zip
ALSA: us122l: Use common error handling code in us122l_create_card()
Add a jump target so that a bit of exception handling can be better reused at the end of this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/usb/usx2y/us122l.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sound/usb/usx2y/us122l.c b/sound/usb/usx2y/us122l.c
index b49d6e953d52..159da1f3924e 100644
--- a/sound/usb/usx2y/us122l.c
+++ b/sound/usb/usx2y/us122l.c
@@ -508,8 +508,7 @@ static bool us122l_create_card(struct snd_card *card)
err = us122l_create_usbmidi(card);
if (err < 0) {
snd_printk(KERN_ERR "us122l_create_usbmidi error %i \n", err);
- us122l_stop(us122l);
- return false;
+ goto stop;
}
err = usb_stream_hwdep_new(card);
if (err < 0) {
@@ -518,10 +517,13 @@ static bool us122l_create_card(struct snd_card *card)
list_for_each(p, &us122l->midi_list)
snd_usbmidi_disconnect(p);
- us122l_stop(us122l);
- return false;
+ goto stop;
}
return true;
+
+stop:
+ us122l_stop(us122l);
+ return false;
}
static void snd_us122l_free(struct snd_card *card)