err = request_firmware(&chip->assp_kernel_image,
"ess/maestro3_assp_kernel.fw", &pci->dev);
- if (err < 0) {
- snd_m3_free(chip);
- return err;
- }
+ if (err < 0)
+ goto free_chip;
err = request_firmware(&chip->assp_minisrc_image,
"ess/maestro3_assp_minisrc.fw", &pci->dev);
- if (err < 0) {
- snd_m3_free(chip);
- return err;
- }
+ if (err < 0)
+ goto free_chip;
+
+ err = pci_request_regions(pci, card->driver);
+ if (err < 0)
+ goto free_chip;
- if ((err = pci_request_regions(pci, card->driver)) < 0) {
- snd_m3_free(chip);
- return err;
- }
chip->iobase = pci_resource_start(pci, 0);
/* just to be sure */
if (request_irq(pci->irq, snd_m3_interrupt, IRQF_SHARED,
KBUILD_MODNAME, chip)) {
dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq);
- snd_m3_free(chip);
- return -ENOMEM;
+ err = -ENOMEM;
+ goto free_chip;
}
chip->irq = pci->irq;
dev_warn(card->dev, "can't allocate apm buffer\n");
#endif
- if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
- snd_m3_free(chip);
- return err;
- }
+ err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
+ if (err < 0)
+ goto free_chip;
if ((err = snd_m3_mixer(chip)) < 0)
return err;
*chip_ret = chip;
return 0;
+
+free_chip:
+ snd_m3_free(chip);
+ return err;
}
/*
break;
}
- if ((err = snd_m3_create(card, pci,
- external_amp[dev],
- amp_gpio[dev],
- &chip)) < 0) {
- snd_card_free(card);
- return err;
- }
+ err = snd_m3_create(card, pci, external_amp[dev], amp_gpio[dev], &chip);
+ if (err < 0)
+ goto free_card;
+
card->private_data = chip;
sprintf(card->shortname, "ESS %s PCI", card->driver);
sprintf(card->longname, "%s at 0x%lx, irq %d",
card->shortname, chip->iobase, chip->irq);
- if ((err = snd_card_register(card)) < 0) {
- snd_card_free(card);
- return err;
- }
+ err = snd_card_register(card);
+ if (err < 0)
+ goto free_card;
#if 0 /* TODO: not supported yet */
/* TODO enable MIDI IRQ and I/O */
pci_set_drvdata(pci, card);
dev++;
return 0;
+
+free_card:
+ snd_card_free(card);
+ return err;
}
static void snd_m3_remove(struct pci_dev *pci)