diff options
Diffstat (limited to 'sound/pcmcia')
-rw-r--r-- | sound/pcmcia/pdaudiocf/pdaudiocf.c | 19 | ||||
-rw-r--r-- | sound/pcmcia/vx/vxpocket.c | 32 |
2 files changed, 29 insertions, 22 deletions
diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf.c b/sound/pcmcia/pdaudiocf/pdaudiocf.c index 819aaaac432f..7dea74b71cf1 100644 --- a/sound/pcmcia/pdaudiocf/pdaudiocf.c +++ b/sound/pcmcia/pdaudiocf/pdaudiocf.c | |||
@@ -91,7 +91,7 @@ static int snd_pdacf_dev_free(struct snd_device *device) | |||
91 | */ | 91 | */ |
92 | static int snd_pdacf_probe(struct pcmcia_device *link) | 92 | static int snd_pdacf_probe(struct pcmcia_device *link) |
93 | { | 93 | { |
94 | int i; | 94 | int i, err; |
95 | struct snd_pdacf *pdacf; | 95 | struct snd_pdacf *pdacf; |
96 | struct snd_card *card; | 96 | struct snd_card *card; |
97 | static struct snd_device_ops ops = { | 97 | static struct snd_device_ops ops = { |
@@ -112,20 +112,23 @@ static int snd_pdacf_probe(struct pcmcia_device *link) | |||
112 | return -ENODEV; /* disabled explicitly */ | 112 | return -ENODEV; /* disabled explicitly */ |
113 | 113 | ||
114 | /* ok, create a card instance */ | 114 | /* ok, create a card instance */ |
115 | card = snd_card_new(index[i], id[i], THIS_MODULE, 0); | 115 | err = snd_card_create(index[i], id[i], THIS_MODULE, 0, &card); |
116 | if (card == NULL) { | 116 | if (err < 0) { |
117 | snd_printk(KERN_ERR "pdacf: cannot create a card instance\n"); | 117 | snd_printk(KERN_ERR "pdacf: cannot create a card instance\n"); |
118 | return -ENOMEM; | 118 | return err; |
119 | } | 119 | } |
120 | 120 | ||
121 | pdacf = snd_pdacf_create(card); | 121 | pdacf = snd_pdacf_create(card); |
122 | if (! pdacf) | 122 | if (!pdacf) { |
123 | return -EIO; | 123 | snd_card_free(card); |
124 | return -ENOMEM; | ||
125 | } | ||
124 | 126 | ||
125 | if (snd_device_new(card, SNDRV_DEV_LOWLEVEL, pdacf, &ops) < 0) { | 127 | err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, pdacf, &ops); |
128 | if (err < 0) { | ||
126 | kfree(pdacf); | 129 | kfree(pdacf); |
127 | snd_card_free(card); | 130 | snd_card_free(card); |
128 | return -ENODEV; | 131 | return err; |
129 | } | 132 | } |
130 | 133 | ||
131 | snd_card_set_dev(card, &handle_to_dev(link)); | 134 | snd_card_set_dev(card, &handle_to_dev(link)); |
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 | */ |
133 | static struct snd_vxpocket *snd_vxpocket_new(struct snd_card *card, int ibl, | 133 | static 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 | ||