diff options
author | Takashi Iwai <tiwai@alsa3.local> | 2008-12-28 16:47:30 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-01-12 15:21:54 +0100 |
commit | 3e7fb9f7ec00fd7cefd0d8e83df0cff86ce12515 (patch) | |
tree | dd04faa1ccf4d894bda0ca14eb667bc4be096623 /sound/isa/gus | |
parent | d453379bc5d34d7f55b55931245de5ac1896fd8d (diff) |
ALSA: Return proper error code at probe in sound/isa/*
Some drivers in sound/isa/* don't handle the error code properly
from snd_card_create(). This patch fixes these places.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/isa/gus')
-rw-r--r-- | sound/isa/gus/interwave.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c index e040c763891..50e429a120d 100644 --- a/sound/isa/gus/interwave.c +++ b/sound/isa/gus/interwave.c @@ -626,7 +626,7 @@ static void snd_interwave_free(struct snd_card *card) free_irq(iwcard->irq, (void *)iwcard); } -static struct snd_card *snd_interwave_card_new(int dev) +static int snd_interwave_card_new(int dev, struct snd_card **cardp) { struct snd_card *card; struct snd_interwave *iwcard; @@ -635,12 +635,13 @@ static struct snd_card *snd_interwave_card_new(int dev) err = snd_card_create(index[dev], id[dev], THIS_MODULE, sizeof(struct snd_interwave), &card); if (err < 0) - return NULL; + return err; iwcard = card->private_data; iwcard->card = card; iwcard->irq = -1; card->private_free = snd_interwave_free; - return card; + *cardp = card; + return 0; } static int __devinit snd_interwave_probe(struct snd_card *card, int dev) @@ -779,9 +780,9 @@ static int __devinit snd_interwave_isa_probe1(int dev, struct device *devptr) struct snd_card *card; int err; - card = snd_interwave_card_new(dev); - if (! card) - return -ENOMEM; + err = snd_interwave_card_new(dev, &card); + if (err < 0) + return err; snd_card_set_dev(card, devptr); if ((err = snd_interwave_probe(card, dev)) < 0) { @@ -877,9 +878,9 @@ static int __devinit snd_interwave_pnp_detect(struct pnp_card_link *pcard, if (dev >= SNDRV_CARDS) return -ENODEV; - card = snd_interwave_card_new(dev); - if (! card) - return -ENOMEM; + res = snd_interwave_card_new(dev, &card); + if (res < 0) + return res; if ((res = snd_interwave_pnp(dev, card->private_data, pcard, pid)) < 0) { snd_card_free(card); |