diff options
author | Markus Elfring <elfring@users.sourceforge.net> | 2017-09-06 17:26:29 +0300 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2017-09-07 11:29:35 +0300 |
commit | f804fff1361c9da30efc21721dc0ae5934413c4b (patch) | |
tree | 81dca7d9a6e3a13350b0366dd34f37523b7a46cb /sound | |
parent | d2d977087970526ac7c8b08a492081ea2e1f6c29 (diff) | |
download | linux-f804fff1361c9da30efc21721dc0ae5934413c4b.tar.xz |
ALSA: 6fire: Use common error handling code in usb6fire_chip_probe()
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/6fire/chip.c | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/sound/usb/6fire/chip.c b/sound/usb/6fire/chip.c index bc2a24f7a791..c7641cb50616 100644 --- a/sound/usb/6fire/chip.c +++ b/sound/usb/6fire/chip.c @@ -143,37 +143,32 @@ static int usb6fire_chip_probe(struct usb_interface *intf, chip->card = card; ret = usb6fire_comm_init(chip); - if (ret < 0) { - usb6fire_chip_destroy(chip); - return ret; - } + if (ret < 0) + goto destroy_chip; ret = usb6fire_midi_init(chip); - if (ret < 0) { - usb6fire_chip_destroy(chip); - return ret; - } + if (ret < 0) + goto destroy_chip; ret = usb6fire_pcm_init(chip); - if (ret < 0) { - usb6fire_chip_destroy(chip); - return ret; - } + if (ret < 0) + goto destroy_chip; ret = usb6fire_control_init(chip); - if (ret < 0) { - usb6fire_chip_destroy(chip); - return ret; - } + if (ret < 0) + goto destroy_chip; ret = snd_card_register(card); if (ret < 0) { dev_err(&intf->dev, "cannot register card."); - usb6fire_chip_destroy(chip); - return ret; + goto destroy_chip; } usb_set_intfdata(intf, chip); return 0; + +destroy_chip: + usb6fire_chip_destroy(chip); + return ret; } static void usb6fire_chip_disconnect(struct usb_interface *intf) |