ALSA: us122l: Use common error handling code in us122l_create_card()
authorMarkus Elfring <elfring@users.sourceforge.net>
Wed, 6 Sep 2017 12:45:09 +0000 (14:45 +0200)
committerTakashi Iwai <tiwai@suse.de>
Thu, 7 Sep 2017 08:27:42 +0000 (10:27 +0200)
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>
sound/usb/usx2y/us122l.c

index b49d6e953d52f9db202d63cbd5a4cfbceb45ed2d..159da1f3924e984ccacdb6dcb349adc6080bb9b5 100644 (file)
@@ -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)