aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pcmcia/vx/vxpocket.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pcmcia/vx/vxpocket.c')
-rw-r--r--sound/pcmcia/vx/vxpocket.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/sound/pcmcia/vx/vxpocket.c b/sound/pcmcia/vx/vxpocket.c
index 706602a40600..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
@@ -292,7 +296,7 @@ static int vxpocket_probe(struct pcmcia_device *p_dev)
292{ 296{
293 struct snd_card *card; 297 struct snd_card *card;
294 struct snd_vxpocket *vxp; 298 struct snd_vxpocket *vxp;
295 int i; 299 int i, err;
296 300
297 /* find an empty slot from the card list */ 301 /* find an empty slot from the card list */
298 for (i = 0; i < SNDRV_CARDS; i++) { 302 for (i = 0; i < SNDRV_CARDS; i++) {
@@ -307,16 +311,16 @@ static int vxpocket_probe(struct pcmcia_device *p_dev)
307 return -ENODEV; /* disabled explicitly */ 311 return -ENODEV; /* disabled explicitly */
308 312
309 /* ok, create a card instance */ 313 /* ok, create a card instance */
310 card = snd_card_new(index[i], id[i], THIS_MODULE, 0); 314 err = snd_card_create(index[i], id[i], THIS_MODULE, 0, &card);
311 if (card == NULL) { 315 if (err < 0) {
312 snd_printk(KERN_ERR "vxpocket: cannot create a card instance\n"); 316 snd_printk(KERN_ERR "vxpocket: cannot create a card instance\n");
313 return -ENOMEM; 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