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>
diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c
index db83068..f784598 100644
--- a/sound/isa/cs423x/cs4236.c
+++ b/sound/isa/cs423x/cs4236.c
@@ -382,7 +382,7 @@
 	release_and_free_resource(acard->res_sb_port);
 }
 
-static struct snd_card *snd_cs423x_card_new(int dev)
+static int snd_cs423x_card_new(int dev, struct snd_card **cardp)
 {
 	struct snd_card *card;
 	int err;
@@ -390,9 +390,10 @@
 	err = snd_card_create(index[dev], id[dev], THIS_MODULE,
 			      sizeof(struct snd_card_cs4236), &card);
 	if (err < 0)
-		return NULL;
+		return err;
 	card->private_free = snd_card_cs4236_free;
-	return card;
+	*cardp = card;
+	return 0;
 }
 
 static int __devinit snd_cs423x_probe(struct snd_card *card, int dev)
@@ -513,9 +514,9 @@
 	struct snd_card *card;
 	int err;
 
-	card = snd_cs423x_card_new(dev);
-	if (! card)
-		return -ENOMEM;
+	err = snd_cs423x_card_new(dev, &card);
+	if (err < 0)
+		return err;
 	snd_card_set_dev(card, pdev);
 	if ((err = snd_cs423x_probe(card, dev)) < 0) {
 		snd_card_free(card);
@@ -595,9 +596,9 @@
 	if (dev >= SNDRV_CARDS)
 		return -ENODEV;
 
-	card = snd_cs423x_card_new(dev);
-	if (! card)
-		return -ENOMEM;
+	err = snd_cs423x_card_new(dev, &card);
+	if (err < 0)
+		return err;
 	if ((err = snd_card_cs4232_pnp(dev, card->private_data, pdev)) < 0) {
 		printk(KERN_ERR "PnP BIOS detection failed for " IDENT "\n");
 		snd_card_free(card);
@@ -657,9 +658,9 @@
 	if (dev >= SNDRV_CARDS)
 		return -ENODEV;
 
-	card = snd_cs423x_card_new(dev);
-	if (! card)
-		return -ENOMEM;
+	res = snd_cs423x_card_new(dev, &card);
+	if (res < 0)
+		return res;
 	if ((res = snd_card_cs423x_pnpc(dev, card->private_data, pcard, pid)) < 0) {
 		printk(KERN_ERR "isapnp detection failed and probing for " IDENT
 		       " is not supported\n");
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c
index c24c632..8cfbff7 100644
--- a/sound/isa/es18xx.c
+++ b/sound/isa/es18xx.c
@@ -2125,13 +2125,10 @@
 #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 @@
 	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 @@
 	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 @@
 	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);
diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c
index e040c76..50e429a 100644
--- a/sound/isa/gus/interwave.c
+++ b/sound/isa/gus/interwave.c
@@ -626,7 +626,7 @@
 		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 @@
 	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 @@
 	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 @@
 	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);
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c
index 5750f38..87a4feb 100644
--- a/sound/isa/opti9xx/opti92x-ad1848.c
+++ b/sound/isa/opti9xx/opti92x-ad1848.c
@@ -830,17 +830,17 @@
 	return snd_card_register(card);
 }
 
-static struct snd_card *snd_opti9xx_card_new(void)
+static int snd_opti9xx_card_new(struct snd_card **cardp)
 {
 	struct snd_card *card;
-	int err;
 
 	err = snd_card_create(index, id, THIS_MODULE,
 			      sizeof(struct snd_opti9xx), &card);
 	if (err < 0)
-		return NULL;
+		return err;
 	card->private_free = snd_card_opti9xx_free;
-	return card;
+	*cardp = card;
+	return 0;
 }
 
 static int __devinit snd_opti9xx_isa_match(struct device *devptr,
@@ -905,9 +905,9 @@
 	}
 #endif
 
-	card = snd_opti9xx_card_new();
-	if (! card)
-		return -ENOMEM;
+	error = snd_opti9xx_card_new(&card);
+	if (error < 0)
+		return error;
 
 	if ((error = snd_card_opti9xx_detect(card, card->private_data)) < 0) {
 		snd_card_free(card);
@@ -952,9 +952,9 @@
 		return -EBUSY;
 	if (! isapnp)
 		return -ENODEV;
-	card = snd_opti9xx_card_new();
-	if (! card)
-		return -ENOMEM;
+	error = snd_opti9xx_card_new(&card);
+	if (error < 0)
+		return error;
 	chip = card->private_data;
 
 	hw = snd_card_opti9xx_pnp(chip, pcard, pid);
diff --git a/sound/isa/sb/sb16.c b/sound/isa/sb/sb16.c
index adf4fdd..519c363 100644
--- a/sound/isa/sb/sb16.c
+++ b/sound/isa/sb/sb16.c
@@ -324,7 +324,7 @@
 #define is_isapnp_selected(dev)		0
 #endif
 
-static struct snd_card *snd_sb16_card_new(int dev)
+static int snd_sb16_card_new(int dev, struct snd_card **cardp)
 {
 	struct snd_card *card;
 	int err;
@@ -332,9 +332,10 @@
 	err = snd_card_create(index[dev], id[dev], THIS_MODULE,
 			      sizeof(struct snd_card_sb16), &card);
 	if (err < 0)
-		return NULL;
+		return err;
 	card->private_free = snd_sb16_free;
-	return card;
+	*cardp = card;
+	return 0;
 }
 
 static int __devinit snd_sb16_probe(struct snd_card *card, int dev)
@@ -492,9 +493,9 @@
 	struct snd_card *card;
 	int err;
 
-	card = snd_sb16_card_new(dev);
-	if (! card)
-		return -ENOMEM;
+	err = snd_sb16_card_new(dev, &card);
+	if (err < 0)
+		return err;
 
 	acard = card->private_data;
 	/* non-PnP FM port address is hardwired with base port address */
@@ -613,9 +614,9 @@
 	for ( ; dev < SNDRV_CARDS; dev++) {
 		if (!enable[dev] || !isapnp[dev])
 			continue;
-		card = snd_sb16_card_new(dev);
-		if (! card)
-			return -ENOMEM;
+		res = snd_sb16_card_new(dev, &card);
+		if (res < 0)
+			return res;
 		snd_card_set_dev(card, &pcard->card->dev);
 		if ((res = snd_card_sb16_pnp(dev, card->private_data, pcard, pid)) < 0 ||
 		    (res = snd_sb16_probe(card, dev)) < 0) {
diff --git a/sound/isa/wavefront/wavefront.c b/sound/isa/wavefront/wavefront.c
index 82b8fb7..95898b2 100644
--- a/sound/isa/wavefront/wavefront.c
+++ b/sound/isa/wavefront/wavefront.c
@@ -338,7 +338,7 @@
 	}
 }
 
-static struct snd_card *snd_wavefront_card_new(int dev)
+static int snd_wavefront_card_new(int dev, struct snd_card **cardp)
 {
 	struct snd_card *card;
 	snd_wavefront_card_t *acard;
@@ -347,7 +347,7 @@
 	err = snd_card_create(index[dev], id[dev], THIS_MODULE,
 			      sizeof(snd_wavefront_card_t), &card);
 	if (err < 0)
-		return NULL;
+		return err;
 
 	acard = card->private_data;
 	acard->wavefront.irq = -1;
@@ -358,7 +358,8 @@
 	acard->wavefront.card = card;
 	card->private_free = snd_wavefront_free;
 
-	return card;
+	*cardp = card;
+	return 0;
 }
 
 static int __devinit
@@ -568,9 +569,9 @@
 	struct snd_card *card;
 	int err;
 
-	card = snd_wavefront_card_new(dev);
-	if (! card)
-		return -ENOMEM;
+	err = snd_wavefront_card_new(dev, &card);
+	if (err < 0)
+		return err;
 	snd_card_set_dev(card, pdev);
 	if ((err = snd_wavefront_probe(card, dev)) < 0) {
 		snd_card_free(card);
@@ -617,9 +618,9 @@
 	if (dev >= SNDRV_CARDS)
 		return -ENODEV;
 
-	card = snd_wavefront_card_new(dev);
-	if (! card)
-		return -ENOMEM;
+	res = snd_wavefront_card_new(dev, &card);
+	if (res < 0)
+		return res;
 
 	if (snd_wavefront_pnp (dev, card->private_data, pcard, pid) < 0) {
 		if (cs4232_pcm_port[dev] == SNDRV_AUTO_PORT) {