diff options
author | Markus Elfring <elfring@users.sourceforge.net> | 2017-08-22 13:58:30 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2017-08-22 14:06:10 -0400 |
commit | e17a85eccfa0b7d0089af218b0c468d4b8a3c3c2 (patch) | |
tree | 24582ae4bc8fd157948e388b5cb1fb28d3ec7afb | |
parent | 62a939477173fabfe9f52114fab878a00b87f9a3 (diff) |
ALSA: cmipci: Use common error handling code in snd_cmipci_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>
-rw-r--r-- | sound/pci/cmipci.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c index a45245f16059..26a657870664 100644 --- a/sound/pci/cmipci.c +++ b/sound/pci/cmipci.c | |||
@@ -3295,20 +3295,23 @@ static int snd_cmipci_probe(struct pci_dev *pci, | |||
3295 | break; | 3295 | break; |
3296 | } | 3296 | } |
3297 | 3297 | ||
3298 | if ((err = snd_cmipci_create(card, pci, dev, &cm)) < 0) { | 3298 | err = snd_cmipci_create(card, pci, dev, &cm); |
3299 | snd_card_free(card); | 3299 | if (err < 0) |
3300 | return err; | 3300 | goto free_card; |
3301 | } | 3301 | |
3302 | card->private_data = cm; | 3302 | card->private_data = cm; |
3303 | 3303 | ||
3304 | if ((err = snd_card_register(card)) < 0) { | 3304 | err = snd_card_register(card); |
3305 | snd_card_free(card); | 3305 | if (err < 0) |
3306 | return err; | 3306 | goto free_card; |
3307 | } | 3307 | |
3308 | pci_set_drvdata(pci, card); | 3308 | pci_set_drvdata(pci, card); |
3309 | dev++; | 3309 | dev++; |
3310 | return 0; | 3310 | return 0; |
3311 | 3311 | ||
3312 | free_card: | ||
3313 | snd_card_free(card); | ||
3314 | return err; | ||
3312 | } | 3315 | } |
3313 | 3316 | ||
3314 | static void snd_cmipci_remove(struct pci_dev *pci) | 3317 | static void snd_cmipci_remove(struct pci_dev *pci) |