aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pcmcia/vx
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@alsa3.local>2008-12-28 11:03:56 -0500
committerTakashi Iwai <tiwai@suse.de>2009-01-12 09:21:56 -0500
commit2fa51107c9aa80ae95b4524198442cdea82d08a3 (patch)
treee2e54d232553922fc00d8b835b17778f8ee5e87b /sound/pcmcia/vx
parentaa3d75d80de464cf23af1d068a5e22f1527b6957 (diff)
ALSA: Return proper error code at probe in sound/pcmcia/*
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pcmcia/vx')
-rw-r--r--sound/pcmcia/vx/vxpocket.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/sound/pcmcia/vx/vxpocket.c b/sound/pcmcia/vx/vxpocket.c
index 087ded8a8d72..7445cc8a47d3 100644
--- a/sound/pcmcia/vx/vxpocket.c
+++ b/sound/pcmcia/vx/vxpocket.c
@@ -130,23 +130,26 @@ static struct snd_vx_hardware vxp440_hw = {
130/* 130/*
131 * create vxpocket instance 131 * create vxpocket instance
132 */ 132 */
133static struct snd_vxpocket *snd_vxpocket_new(struct snd_card *card, int ibl, 133static int snd_vxpocket_new(struct snd_card *card, int ibl,
134 struct pcmcia_device *link) 134 struct pcmcia_device *link,
135 struct snd_vxpocket **chip_ret)
135{ 136{
136 struct vx_core *chip; 137 struct vx_core *chip;
137 struct snd_vxpocket *vxp; 138 struct snd_vxpocket *vxp;
138 static struct snd_device_ops ops = { 139 static struct snd_device_ops ops = {
139 .dev_free = snd_vxpocket_dev_free, 140 .dev_free = snd_vxpocket_dev_free,
140 }; 141 };
142 int err;
141 143
142 chip = snd_vx_create(card, &vxpocket_hw, &snd_vxpocket_ops, 144 chip = snd_vx_create(card, &vxpocket_hw, &snd_vxpocket_ops,
143 sizeof(struct snd_vxpocket) - sizeof(struct vx_core)); 145 sizeof(struct snd_vxpocket) - sizeof(struct vx_core));
144 if (! chip) 146 if (!chip)
145 return NULL; 147 return -ENOMEM;
146 148
147 if (snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops) < 0) { 149 err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
150 if (err < 0) {
148 kfree(chip); 151 kfree(chip);
149 return NULL; 152 return err;
150 } 153 }
151 chip->ibl.size = ibl; 154 chip->ibl.size = ibl;
152 155
@@ -169,7 +172,8 @@ static struct snd_vxpocket *snd_vxpocket_new(struct snd_card *card, int ibl,
169 link->conf.ConfigIndex = 1; 172 link->conf.ConfigIndex = 1;
170 link->conf.Present = PRESENT_OPTION; 173 link->conf.Present = PRESENT_OPTION;
171 174
172 return vxp; 175 *chip_ret = vxp;
176 return 0;
173} 177}
174 178
175 179
@@ -313,10 +317,10 @@ static int vxpocket_probe(struct pcmcia_device *p_dev)
313 return err; 317 return err;
314 } 318 }
315 319
316 vxp = snd_vxpocket_new(card, ibl[i], p_dev); 320 err = snd_vxpocket_new(card, ibl[i], p_dev, &vxp);
317 if (! vxp) { 321 if (err < 0) {
318 snd_card_free(card); 322 snd_card_free(card);
319 return -ENODEV; 323 return err;
320 } 324 }
321 card->private_data = vxp; 325 card->private_data = vxp;
322 326