ALSA: rme96: Use common error handling code in snd_rme96_probe()
Add a jump target so that a bit of exception handling can be better reused at the end of this function. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
1b2ff0c0c4
commit
d72a8010ae
@ -2481,21 +2481,20 @@ snd_rme96_probe(struct pci_dev *pci,
|
|||||||
rme96 = card->private_data;
|
rme96 = card->private_data;
|
||||||
rme96->card = card;
|
rme96->card = card;
|
||||||
rme96->pci = pci;
|
rme96->pci = pci;
|
||||||
if ((err = snd_rme96_create(rme96)) < 0) {
|
err = snd_rme96_create(rme96);
|
||||||
snd_card_free(card);
|
if (err)
|
||||||
return err;
|
goto free_card;
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef CONFIG_PM_SLEEP
|
#ifdef CONFIG_PM_SLEEP
|
||||||
rme96->playback_suspend_buffer = vmalloc(RME96_BUFFER_SIZE);
|
rme96->playback_suspend_buffer = vmalloc(RME96_BUFFER_SIZE);
|
||||||
if (!rme96->playback_suspend_buffer) {
|
if (!rme96->playback_suspend_buffer) {
|
||||||
snd_card_free(card);
|
err = -ENOMEM;
|
||||||
return -ENOMEM;
|
goto free_card;
|
||||||
}
|
}
|
||||||
rme96->capture_suspend_buffer = vmalloc(RME96_BUFFER_SIZE);
|
rme96->capture_suspend_buffer = vmalloc(RME96_BUFFER_SIZE);
|
||||||
if (!rme96->capture_suspend_buffer) {
|
if (!rme96->capture_suspend_buffer) {
|
||||||
snd_card_free(card);
|
err = -ENOMEM;
|
||||||
return -ENOMEM;
|
goto free_card;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -2521,14 +2520,16 @@ snd_rme96_probe(struct pci_dev *pci,
|
|||||||
}
|
}
|
||||||
sprintf(card->longname, "%s at 0x%lx, irq %d", card->shortname,
|
sprintf(card->longname, "%s at 0x%lx, irq %d", card->shortname,
|
||||||
rme96->port, rme96->irq);
|
rme96->port, rme96->irq);
|
||||||
|
err = snd_card_register(card);
|
||||||
if ((err = snd_card_register(card)) < 0) {
|
if (err)
|
||||||
snd_card_free(card);
|
goto free_card;
|
||||||
return err;
|
|
||||||
}
|
|
||||||
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_rme96_remove(struct pci_dev *pci)
|
static void snd_rme96_remove(struct pci_dev *pci)
|
||||||
|
Loading…
Reference in New Issue
Block a user