ALSA: Return proper error code at probe in sound/pcmcia/*

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Thursday, March 26, 2009 - 12:04 pm

Gitweb:     http://git.kernel.org/linus/2fa51107c9aa80ae95b4524198442cdea82d08a3
Commit:     2fa51107c9aa80ae95b4524198442cdea82d08a3
Parent:     aa3d75d80de464cf23af1d068a5e22f1527b6957
Author:     Takashi Iwai <tiwai@alsa3.local>
AuthorDate: Sun Dec 28 17:03:56 2008 +0100
Committer:  Takashi Iwai <tiwai@suse.de>
CommitDate: Mon Jan 12 15:21:56 2009 +0100

    ALSA: Return proper error code at probe in sound/pcmcia/*
    
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pcmcia/pdaudiocf/pdaudiocf.c |    7 ++++---
 sound/pcmcia/vx/vxpocket.c         |   24 ++++++++++++++----------
 2 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf.c b/sound/pcmcia/pdaudiocf/pdaudiocf.c
index ec51569..7dea74b 100644
--- a/sound/pcmcia/pdaudiocf/pdaudiocf.c
+++ b/sound/pcmcia/pdaudiocf/pdaudiocf.c
@@ -121,13 +121,14 @@ static int snd_pdacf_probe(struct pcmcia_device *link)
 	pdacf = snd_pdacf_create(card);
 	if (!pdacf) {
 		snd_card_free(card);
-		return -EIO;
+		return -ENOMEM;
 	}
 
-	if (snd_device_new(card, SNDRV_DEV_LOWLEVEL, pdacf, &ops) < 0) {
+	err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, pdacf, &ops);
+	if (err < 0) {
 		kfree(pdacf);
 		snd_card_free(card);
-		return -ENODEV;
+		return err;
 	}
 
 	snd_card_set_dev(card, &handle_to_dev(link));
diff --git a/sound/pcmcia/vx/vxpocket.c b/sound/pcmcia/vx/vxpocket.c
index 087ded8..7445cc8 100644
--- a/sound/pcmcia/vx/vxpocket.c
+++ b/sound/pcmcia/vx/vxpocket.c
@@ -130,23 +130,26 @@ static struct snd_vx_hardware vxp440_hw = {
 /*
  * create vxpocket instance
  */
-static struct snd_vxpocket *snd_vxpocket_new(struct snd_card *card, int ibl,
-					     struct pcmcia_device *link)
+static int snd_vxpocket_new(struct snd_card *card, int ibl,
+			    struct pcmcia_device *link,
+			    struct snd_vxpocket **chip_ret)
 {
 	struct vx_core *chip;
 	struct snd_vxpocket *vxp;
 	static struct snd_device_ops ops = {
 		.dev_free =	snd_vxpocket_dev_free,
 	};
+	int err;
 
 	chip = snd_vx_create(card, &vxpocket_hw, &snd_vxpocket_ops,
 			     sizeof(struct snd_vxpocket) - sizeof(struct vx_core));
-	if (! chip)
-		return NULL;
+	if (!chip)
+		return -ENOMEM;
 
-	if (snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops) < 0) {
+	err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
+	if (err < 0) {
 		kfree(chip);
-		return NULL;
+		return err;
 	}
 	chip->ibl.size = ibl;
 
@@ -169,7 +172,8 @@ static struct snd_vxpocket *snd_vxpocket_new(struct snd_card *card, int ibl,
 	link->conf.ConfigIndex = 1;
 	link->conf.Present = PRESENT_OPTION;
 
-	return vxp;
+	*chip_ret = vxp;
+	return 0;
 }
 
 
@@ -313,10 +317,10 @@ static int vxpocket_probe(struct pcmcia_device *p_dev)
 		return err;
 	}
 
-	vxp = snd_vxpocket_new(card, ibl[i], p_dev);
-	if (! vxp) {
+	err = snd_vxpocket_new(card, ibl[i], p_dev, &vxp);
+	if (err < 0) {
 		snd_card_free(card);
-		return -ENODEV;
+		return err;
 	}
 	card->private_data = vxp;
 
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
ALSA: Return proper error code at probe in sound/pcmcia/*, Linux Kernel Mailing ..., (Thu Mar 26, 12:04 pm)