diff options
Diffstat (limited to 'sound/isa/opl3sa2.c')
-rw-r--r-- | sound/isa/opl3sa2.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c index 06810dfb9d9a..e8d6e1ac88a8 100644 --- a/sound/isa/opl3sa2.c +++ b/sound/isa/opl3sa2.c | |||
@@ -621,21 +621,24 @@ static void snd_opl3sa2_free(struct snd_card *card) | |||
621 | release_and_free_resource(chip->res_port); | 621 | release_and_free_resource(chip->res_port); |
622 | } | 622 | } |
623 | 623 | ||
624 | static struct snd_card *snd_opl3sa2_card_new(int dev) | 624 | static int snd_opl3sa2_card_new(int dev, struct snd_card **cardp) |
625 | { | 625 | { |
626 | struct snd_card *card; | 626 | struct snd_card *card; |
627 | struct snd_opl3sa2 *chip; | 627 | struct snd_opl3sa2 *chip; |
628 | int err; | ||
628 | 629 | ||
629 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(struct snd_opl3sa2)); | 630 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, |
630 | if (card == NULL) | 631 | sizeof(struct snd_opl3sa2), &card); |
631 | return NULL; | 632 | if (err < 0) |
633 | return err; | ||
632 | strcpy(card->driver, "OPL3SA2"); | 634 | strcpy(card->driver, "OPL3SA2"); |
633 | strcpy(card->shortname, "Yamaha OPL3-SA2"); | 635 | strcpy(card->shortname, "Yamaha OPL3-SA2"); |
634 | chip = card->private_data; | 636 | chip = card->private_data; |
635 | spin_lock_init(&chip->reg_lock); | 637 | spin_lock_init(&chip->reg_lock); |
636 | chip->irq = -1; | 638 | chip->irq = -1; |
637 | card->private_free = snd_opl3sa2_free; | 639 | card->private_free = snd_opl3sa2_free; |
638 | return card; | 640 | *cardp = card; |
641 | return 0; | ||
639 | } | 642 | } |
640 | 643 | ||
641 | static int __devinit snd_opl3sa2_probe(struct snd_card *card, int dev) | 644 | static int __devinit snd_opl3sa2_probe(struct snd_card *card, int dev) |
@@ -727,9 +730,9 @@ static int __devinit snd_opl3sa2_pnp_detect(struct pnp_dev *pdev, | |||
727 | if (dev >= SNDRV_CARDS) | 730 | if (dev >= SNDRV_CARDS) |
728 | return -ENODEV; | 731 | return -ENODEV; |
729 | 732 | ||
730 | card = snd_opl3sa2_card_new(dev); | 733 | err = snd_opl3sa2_card_new(dev, &card); |
731 | if (! card) | 734 | if (err < 0) |
732 | return -ENOMEM; | 735 | return err; |
733 | if ((err = snd_opl3sa2_pnp(dev, card->private_data, pdev)) < 0) { | 736 | if ((err = snd_opl3sa2_pnp(dev, card->private_data, pdev)) < 0) { |
734 | snd_card_free(card); | 737 | snd_card_free(card); |
735 | return err; | 738 | return err; |
@@ -793,9 +796,9 @@ static int __devinit snd_opl3sa2_pnp_cdetect(struct pnp_card_link *pcard, | |||
793 | if (dev >= SNDRV_CARDS) | 796 | if (dev >= SNDRV_CARDS) |
794 | return -ENODEV; | 797 | return -ENODEV; |
795 | 798 | ||
796 | card = snd_opl3sa2_card_new(dev); | 799 | err = snd_opl3sa2_card_new(dev, &card); |
797 | if (! card) | 800 | if (err < 0) |
798 | return -ENOMEM; | 801 | return err; |
799 | if ((err = snd_opl3sa2_pnp(dev, card->private_data, pdev)) < 0) { | 802 | if ((err = snd_opl3sa2_pnp(dev, card->private_data, pdev)) < 0) { |
800 | snd_card_free(card); | 803 | snd_card_free(card); |
801 | return err; | 804 | return err; |
@@ -874,9 +877,9 @@ static int __devinit snd_opl3sa2_isa_probe(struct device *pdev, | |||
874 | struct snd_card *card; | 877 | struct snd_card *card; |
875 | int err; | 878 | int err; |
876 | 879 | ||
877 | card = snd_opl3sa2_card_new(dev); | 880 | err = snd_opl3sa2_card_new(dev, &card); |
878 | if (! card) | 881 | if (err < 0) |
879 | return -ENOMEM; | 882 | return err; |
880 | snd_card_set_dev(card, pdev); | 883 | snd_card_set_dev(card, pdev); |
881 | if ((err = snd_opl3sa2_probe(card, dev)) < 0) { | 884 | if ((err = snd_opl3sa2_probe(card, dev)) < 0) { |
882 | snd_card_free(card); | 885 | snd_card_free(card); |