diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-03-24 00:35:35 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-03-24 00:35:35 +0100 |
commit | dec14f8c0eff54549e5747f8a4d1dc6c0347e2dd (patch) | |
tree | af1744c17c4bacad4c9524ad096d5a65f6c25c73 /sound/isa/opl3sa2.c | |
parent | 8e0ee43bc2c3e19db56a4adaa9a9b04ce885cd84 (diff) | |
parent | b1a0aac05f044e78a589bfd7a9e2334aa640eb45 (diff) | |
download | linux-3.10-dec14f8c0eff54549e5747f8a4d1dc6c0347e2dd.tar.gz linux-3.10-dec14f8c0eff54549e5747f8a4d1dc6c0347e2dd.tar.bz2 linux-3.10-dec14f8c0eff54549e5747f8a4d1dc6c0347e2dd.zip |
Merge branch 'topic/snd_card_new-err' into for-linus
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 b848d100186..63e51373ddc 100644 --- a/sound/isa/opl3sa2.c +++ b/sound/isa/opl3sa2.c @@ -623,21 +623,24 @@ static void snd_opl3sa2_free(struct snd_card *card) release_and_free_resource(chip->res_port); } -static struct snd_card *snd_opl3sa2_card_new(int dev) +static int snd_opl3sa2_card_new(int dev, struct snd_card **cardp) { struct snd_card *card; struct snd_opl3sa2 *chip; + int err; - card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(struct snd_opl3sa2)); - if (card == NULL) - return NULL; + err = snd_card_create(index[dev], id[dev], THIS_MODULE, + sizeof(struct snd_opl3sa2), &card); + if (err < 0) + return err; strcpy(card->driver, "OPL3SA2"); strcpy(card->shortname, "Yamaha OPL3-SA2"); chip = card->private_data; spin_lock_init(&chip->reg_lock); chip->irq = -1; card->private_free = snd_opl3sa2_free; - return card; + *cardp = card; + return 0; } static 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, if (dev >= SNDRV_CARDS) return -ENODEV; - card = snd_opl3sa2_card_new(dev); - if (! card) - return -ENOMEM; + err = snd_opl3sa2_card_new(dev, &card); + if (err < 0) + return err; if ((err = snd_opl3sa2_pnp(dev, card->private_data, pdev)) < 0) { snd_card_free(card); return err; @@ -795,9 +798,9 @@ static int __devinit snd_opl3sa2_pnp_cdetect(struct pnp_card_link *pcard, if (dev >= SNDRV_CARDS) return -ENODEV; - card = snd_opl3sa2_card_new(dev); - if (! card) - return -ENOMEM; + err = snd_opl3sa2_card_new(dev, &card); + if (err < 0) + return err; if ((err = snd_opl3sa2_pnp(dev, card->private_data, pdev)) < 0) { snd_card_free(card); return err; @@ -876,9 +879,9 @@ static int __devinit snd_opl3sa2_isa_probe(struct device *pdev, struct snd_card *card; int err; - card = snd_opl3sa2_card_new(dev); - if (! card) - return -ENOMEM; + err = snd_opl3sa2_card_new(dev, &card); + if (err < 0) + return err; snd_card_set_dev(card, pdev); if ((err = snd_opl3sa2_probe(card, dev)) < 0) { snd_card_free(card); |