aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa/opl3sa2.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/isa/opl3sa2.c')
-rw-r--r--sound/isa/opl3sa2.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c
index 3f0b877bc8b5..ef95279da7a3 100644
--- a/sound/isa/opl3sa2.c
+++ b/sound/isa/opl3sa2.c
@@ -627,21 +627,24 @@ static void snd_opl3sa2_free(struct snd_card *card)
627 release_and_free_resource(chip->res_port); 627 release_and_free_resource(chip->res_port);
628} 628}
629 629
630static struct snd_card *snd_opl3sa2_card_new(int dev) 630static int snd_opl3sa2_card_new(int dev, struct snd_card **cardp)
631{ 631{
632 struct snd_card *card; 632 struct snd_card *card;
633 struct snd_opl3sa2 *chip; 633 struct snd_opl3sa2 *chip;
634 int err;
634 635
635 card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(struct snd_opl3sa2)); 636 err = snd_card_create(index[dev], id[dev], THIS_MODULE,
636 if (card == NULL) 637 sizeof(struct snd_opl3sa2), &card);
637 return NULL; 638 if (err < 0)
639 return err;
638 strcpy(card->driver, "OPL3SA2"); 640 strcpy(card->driver, "OPL3SA2");
639 strcpy(card->shortname, "Yamaha OPL3-SA"); 641 strcpy(card->shortname, "Yamaha OPL3-SA");
640 chip = card->private_data; 642 chip = card->private_data;
641 spin_lock_init(&chip->reg_lock); 643 spin_lock_init(&chip->reg_lock);
642 chip->irq = -1; 644 chip->irq = -1;
643 card->private_free = snd_opl3sa2_free; 645 card->private_free = snd_opl3sa2_free;
644 return card; 646 *cardp = card;
647 return 0;
645} 648}
646 649
647static int __devinit snd_opl3sa2_probe(struct snd_card *card, int dev) 650static int __devinit snd_opl3sa2_probe(struct snd_card *card, int dev)
@@ -733,9 +736,9 @@ static int __devinit snd_opl3sa2_pnp_detect(struct pnp_dev *pdev,
733 if (dev >= SNDRV_CARDS) 736 if (dev >= SNDRV_CARDS)
734 return -ENODEV; 737 return -ENODEV;
735 738
736 card = snd_opl3sa2_card_new(dev); 739 err = snd_opl3sa2_card_new(dev, &card);
737 if (! card) 740 if (err < 0)
738 return -ENOMEM; 741 return err;
739 if ((err = snd_opl3sa2_pnp(dev, card->private_data, pdev)) < 0) { 742 if ((err = snd_opl3sa2_pnp(dev, card->private_data, pdev)) < 0) {
740 snd_card_free(card); 743 snd_card_free(card);
741 return err; 744 return err;
@@ -799,9 +802,9 @@ static int __devinit snd_opl3sa2_pnp_cdetect(struct pnp_card_link *pcard,
799 if (dev >= SNDRV_CARDS) 802 if (dev >= SNDRV_CARDS)
800 return -ENODEV; 803 return -ENODEV;
801 804
802 card = snd_opl3sa2_card_new(dev); 805 err = snd_opl3sa2_card_new(dev, &card);
803 if (! card) 806 if (err < 0)
804 return -ENOMEM; 807 return err;
805 if ((err = snd_opl3sa2_pnp(dev, card->private_data, pdev)) < 0) { 808 if ((err = snd_opl3sa2_pnp(dev, card->private_data, pdev)) < 0) {
806 snd_card_free(card); 809 snd_card_free(card);
807 return err; 810 return err;
@@ -880,9 +883,9 @@ static int __devinit snd_opl3sa2_isa_probe(struct device *pdev,
880 struct snd_card *card; 883 struct snd_card *card;
881 int err; 884 int err;
882 885
883 card = snd_opl3sa2_card_new(dev); 886 err = snd_opl3sa2_card_new(dev, &card);
884 if (! card) 887 if (err < 0)
885 return -ENOMEM; 888 return err;
886 snd_card_set_dev(card, pdev); 889 snd_card_set_dev(card, pdev);
887 if ((err = snd_opl3sa2_probe(card, dev)) < 0) { 890 if ((err = snd_opl3sa2_probe(card, dev)) < 0) {
888 snd_card_free(card); 891 snd_card_free(card);