@@ -1478,17 +1478,15 @@ static int snd_sonic_probe(struct pci_dev *pci,
for (idx = 0; idx < 5; idx++) {
if (pci_resource_start(pci, idx) == 0 ||
!(pci_resource_flags(pci, idx) & IORESOURCE_IO)) {
- snd_card_free(card);
- return -ENODEV;
+ err = -ENODEV;
+ goto free_card;
}
}
err = snd_sonicvibes_create(card, pci, reverb[dev] ? 1 : 0,
mge[dev] ? 1 : 0, &sonic);
- if (err < 0) {
- snd_card_free(card);
- return err;
- }
+ if (err < 0)
+ goto free_card;
strcpy(card->driver, "SonicVibes");
strcpy(card->shortname, "S3 SonicVibes");
@@ -1499,48 +1497,44 @@ static int snd_sonic_probe(struct pci_dev *pci,
sonic->irq);
err = snd_sonicvibes_pcm(sonic, 0);
- if (err < 0) {
- snd_card_free(card);
- return err;
- }
+ if (err < 0)
+ goto free_card;
+
err = snd_sonicvibes_mixer(sonic);
- if (err < 0) {
- snd_card_free(card);
- return err;
- }
+ if (err < 0)
+ goto free_card;
+
err = snd_mpu401_uart_new(card, 0, MPU401_HW_SONICVIBES,
sonic->midi_port,
MPU401_INFO_INTEGRATED | MPU401_INFO_IRQ_HOOK,
-1, &midi_uart);
- if (err < 0) {
- snd_card_free(card);
- return err;
- }
+ if (err < 0)
+ goto free_card;
+
snd_sonicvibes_midi(sonic, midi_uart);
err = snd_opl3_create(card, sonic->synth_port,
sonic->synth_port + 2,
OPL3_HW_OPL3_SV, 1, &opl3);
- if (err < 0) {
- snd_card_free(card);
- return err;
- }
+ if (err < 0)
+ goto free_card;
+
err = snd_opl3_hwdep_new(opl3, 0, 1, NULL);
- if (err < 0) {
- snd_card_free(card);
- return err;
- }
+ if (err < 0)
+ goto free_card;
snd_sonicvibes_create_gameport(sonic);
err = snd_card_register(card);
- if (err < 0) {
- snd_card_free(card);
- return err;
- }
+ if (err < 0)
+ goto free_card;
pci_set_drvdata(pci, card);
dev++;
return 0;
+
+free_card:
+ snd_card_free(card);
+ return err;
}
static void snd_sonic_remove(struct pci_dev *pci)