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/es18xx.c | |
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/es18xx.c')
-rw-r--r-- | sound/isa/es18xx.c | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c index c24c6322fcc9..8cfbff73a835 100644 --- a/sound/isa/es18xx.c +++ b/sound/isa/es18xx.c @@ -2125,13 +2125,10 @@ static int __devinit snd_audiodrive_pnpc(int dev, struct snd_audiodrive *acard, #define is_isapnp_selected(dev) 0 #endif -static struct snd_card *snd_es18xx_card_new(int dev) +static int snd_es18xx_card_new(int dev, struct snd_card **cardp) { - struct snd_card *card; - if (snd_card_create(index[dev], id[dev], THIS_MODULE, - sizeof(struct snd_audiodrive), &card) < 0) - return NULL; - return card; + return snd_card_create(index[dev], id[dev], THIS_MODULE, + sizeof(struct snd_audiodrive), cardp); } static int __devinit snd_audiodrive_probe(struct snd_card *card, int dev) @@ -2200,9 +2197,9 @@ static int __devinit snd_es18xx_isa_probe1(int dev, struct device *devptr) struct snd_card *card; int err; - card = snd_es18xx_card_new(dev); - if (! card) - return -ENOMEM; + err = snd_es18xx_card_new(dev, &card); + if (err < 0) + return err; snd_card_set_dev(card, devptr); if ((err = snd_audiodrive_probe(card, dev)) < 0) { snd_card_free(card); @@ -2306,9 +2303,9 @@ static int __devinit snd_audiodrive_pnp_detect(struct pnp_dev *pdev, if (dev >= SNDRV_CARDS) return -ENODEV; - card = snd_es18xx_card_new(dev); - if (! card) - return -ENOMEM; + err = snd_es18xx_card_new(dev, &card); + if (err < 0) + return err; if ((err = snd_audiodrive_pnp(dev, card->private_data, pdev)) < 0) { snd_card_free(card); return err; @@ -2365,9 +2362,9 @@ static int __devinit snd_audiodrive_pnpc_detect(struct pnp_card_link *pcard, if (dev >= SNDRV_CARDS) return -ENODEV; - card = snd_es18xx_card_new(dev); - if (! card) - return -ENOMEM; + res = snd_es18xx_card_new(dev, &card); + if (res < 0) + return res; if ((res = snd_audiodrive_pnpc(dev, card->private_data, pcard, pid)) < 0) { snd_card_free(card); |