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>
This commit is contained in:
Markus Elfring 2017-08-22 19:58:30 +02:00 committed by Takashi Iwai
parent 62a9394771
commit e17a85eccf
1 changed files with 11 additions and 8 deletions

View File

@ -3295,20 +3295,23 @@ static int snd_cmipci_probe(struct pci_dev *pci,
break; break;
} }
if ((err = snd_cmipci_create(card, pci, dev, &cm)) < 0) { err = snd_cmipci_create(card, pci, dev, &cm);
snd_card_free(card); if (err < 0)
return err; goto free_card;
}
card->private_data = cm; card->private_data = cm;
if ((err = snd_card_register(card)) < 0) { err = snd_card_register(card);
snd_card_free(card); if (err < 0)
return err; goto free_card;
}
pci_set_drvdata(pci, card); pci_set_drvdata(pci, card);
dev++; dev++;
return 0; return 0;
free_card:
snd_card_free(card);
return err;
} }
static void snd_cmipci_remove(struct pci_dev *pci) static void snd_cmipci_remove(struct pci_dev *pci)