aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa/opl3sa2.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-03-23 19:35:35 -0400
committerTakashi Iwai <tiwai@suse.de>2009-03-23 19:35:35 -0400
commitdec14f8c0eff54549e5747f8a4d1dc6c0347e2dd (patch)
treeaf1744c17c4bacad4c9524ad096d5a65f6c25c73 /sound/isa/opl3sa2.c
parent8e0ee43bc2c3e19db56a4adaa9a9b04ce885cd84 (diff)
parentb1a0aac05f044e78a589bfd7a9e2334aa640eb45 (diff)
Merge branch 'topic/snd_card_new-err' into for-linus
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 b848d1001864..63e51373ddc7 100644
--- a/sound/isa/opl3sa2.c
+++ b/sound/isa/opl3sa2.c
@@ -623,21 +623,24 @@ static void snd_opl3sa2_free(struct snd_card *card)
623 release_and_free_resource(chip->res_port); 623 release_and_free_resource(chip->res_port);
624} 624}
625 625
626static struct snd_card *snd_opl3sa2_card_new(int dev) 626static int snd_opl3sa2_card_new(int dev, struct snd_card **cardp)
627{ 627{
628 struct snd_card *card; 628 struct snd_card *card;
629 struct snd_opl3sa2 *chip; 629 struct snd_opl3sa2 *chip;
630 int err;
630 631
631 card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(struct snd_opl3sa2)); 632 err = snd_card_create(index[dev], id[dev], THIS_MODULE,
632 if (card == NULL) 633 sizeof(struct snd_opl3sa2), &card);
633 return NULL; 634 if (err < 0)
635 return err;
634 strcpy(card->driver, "OPL3SA2"); 636 strcpy(card->driver, "OPL3SA2");
635 strcpy(card->shortname, "Yamaha OPL3-SA2"); 637 strcpy(card->shortname, "Yamaha OPL3-SA2");
636 chip = card->private_data; 638 chip = card->private_data;
637 spin_lock_init(&chip->reg_lock); 639 spin_lock_init(&chip->reg_lock);
638 chip->irq = -1; 640 chip->irq = -1;
639 card->private_free = snd_opl3sa2_free; 641 card->private_free = snd_opl3sa2_free;
640 return card; 642 *cardp = card;
643 return 0;
641} 644}
642 645
643static int __devinit snd_opl3sa2_probe(struct snd_card *card, int dev) 646static int __devinit snd_opl3sa2_probe(struct snd_card *card, int dev)
@@ -729,9 +732,9 @@ static int __devinit snd_opl3sa2_pnp_detect(struct pnp_dev *pdev,
729 if (dev >= SNDRV_CARDS) 732 if (dev >= SNDRV_CARDS)
730 return -ENODEV; 733 return -ENODEV;
731 734
732 card = snd_opl3sa2_card_new(dev); 735 err = snd_opl3sa2_card_new(dev, &card);
733 if (! card) 736 if (err < 0)
734 return -ENOMEM; 737 return err;
735 if ((err = snd_opl3sa2_pnp(dev, card->private_data, pdev)) < 0) { 738 if ((err = snd_opl3sa2_pnp(dev, card->private_data, pdev)) < 0) {
736 snd_card_free(card); 739 snd_card_free(card);
737 return err; 740 return err;
@@ -795,9 +798,9 @@ static int __devinit snd_opl3sa2_pnp_cdetect(struct pnp_card_link *pcard,
795 if (dev >= SNDRV_CARDS) 798 if (dev >= SNDRV_CARDS)
796 return -ENODEV; 799 return -ENODEV;
797 800
798 card = snd_opl3sa2_card_new(dev); 801 err = snd_opl3sa2_card_new(dev, &card);
799 if (! card) 802 if (err < 0)
800 return -ENOMEM; 803 return err;
801 if ((err = snd_opl3sa2_pnp(dev, card->private_data, pdev)) < 0) { 804 if ((err = snd_opl3sa2_pnp(dev, card->private_data, pdev)) < 0) {
802 snd_card_free(card); 805 snd_card_free(card);
803 return err; 806 return err;
@@ -876,9 +879,9 @@ static int __devinit snd_opl3sa2_isa_probe(struct device *pdev,
876 struct snd_card *card; 879 struct snd_card *card;
877 int err; 880 int err;
878 881
879 card = snd_opl3sa2_card_new(dev); 882 err = snd_opl3sa2_card_new(dev, &card);
880 if (! card) 883 if (err < 0)
881 return -ENOMEM; 884 return err;
882 snd_card_set_dev(card, pdev); 885 snd_card_set_dev(card, pdev);
883 if ((err = snd_opl3sa2_probe(card, dev)) < 0) { 886 if ((err = snd_opl3sa2_probe(card, dev)) < 0) {
884 snd_card_free(card); 887 snd_card_free(card);