aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/aoa/core/alsa.c7
-rw-r--r--sound/arm/aaci.c7
-rw-r--r--sound/arm/pxa2xx-ac97.c7
-rw-r--r--sound/arm/sa11xx-uda1341.c7
-rw-r--r--sound/core/hwdep.c9
-rw-r--r--sound/core/init.c47
-rw-r--r--sound/core/jack.c45
-rw-r--r--sound/core/misc.c10
-rw-r--r--sound/core/oss/mixer_oss.c3
-rw-r--r--sound/core/oss/pcm_oss.c4
-rw-r--r--sound/core/sgbuf.c7
-rw-r--r--sound/drivers/dummy.c8
-rw-r--r--sound/drivers/ml403-ac97cr.c6
-rw-r--r--sound/drivers/mpu401/mpu401.c6
-rw-r--r--sound/drivers/mtpav.c6
-rw-r--r--sound/drivers/mts64.c6
-rw-r--r--sound/drivers/pcsp/pcsp.c6
-rw-r--r--sound/drivers/portman2x4.c6
-rw-r--r--sound/drivers/serial-u16550.c6
-rw-r--r--sound/drivers/virmidi.c8
-rw-r--r--sound/drivers/vx/vx_hwdep.c12
-rw-r--r--sound/isa/ad1816a/ad1816a.c7
-rw-r--r--sound/isa/ad1848/ad1848.c6
-rw-r--r--sound/isa/adlib.c6
-rw-r--r--sound/isa/als100.c7
-rw-r--r--sound/isa/azt2320.c7
-rw-r--r--sound/isa/cmi8330.c26
-rw-r--r--sound/isa/cs423x/cs4231.c6
-rw-r--r--sound/isa/cs423x/cs4236.c32
-rw-r--r--sound/isa/dt019x.c7
-rw-r--r--sound/isa/es1688/es1688.c6
-rw-r--r--sound/isa/es18xx.c24
-rw-r--r--sound/isa/gus/gusclassic.c6
-rw-r--r--sound/isa/gus/gusextreme.c6
-rw-r--r--sound/isa/gus/gusmax.c8
-rw-r--r--sound/isa/gus/interwave.c26
-rw-r--r--sound/isa/opl3sa2.c49
-rw-r--r--sound/isa/opti9xx/miro.c7
-rw-r--r--sound/isa/opti9xx/opti92x-ad1848.c25
-rw-r--r--sound/isa/sb/es968.c7
-rw-r--r--sound/isa/sb/sb16.c28
-rw-r--r--sound/isa/sb/sb8.c8
-rw-r--r--sound/isa/sc6000.c6
-rw-r--r--sound/isa/sgalaxy.c6
-rw-r--r--sound/isa/sscape.c16
-rw-r--r--sound/isa/wavefront/wavefront.c26
-rw-r--r--sound/mips/au1x00.c7
-rw-r--r--sound/mips/hal2.c6
-rw-r--r--sound/mips/sgio2audio.c6
-rw-r--r--sound/parisc/harmony.c6
-rw-r--r--sound/pci/ad1889.c6
-rw-r--r--sound/pci/ali5451/ali5451.c6
-rw-r--r--sound/pci/als300.c6
-rw-r--r--sound/pci/als4000.c9
-rw-r--r--sound/pci/atiixp.c6
-rw-r--r--sound/pci/atiixp_modem.c6
-rw-r--r--sound/pci/au88x0/au88x0.c6
-rw-r--r--sound/pci/aw2/aw2-alsa.c6
-rw-r--r--sound/pci/azt3328.c6
-rw-r--r--sound/pci/bt87x.c6
-rw-r--r--sound/pci/ca0106/ca0106_main.c6
-rw-r--r--sound/pci/cmipci.c6
-rw-r--r--sound/pci/cs4281.c6
-rw-r--r--sound/pci/cs46xx/cs46xx.c6
-rw-r--r--sound/pci/cs5530.c6
-rw-r--r--sound/pci/cs5535audio/cs5535audio.c6
-rw-r--r--sound/pci/echoaudio/echoaudio.c6
-rw-r--r--sound/pci/emu10k1/emu10k1.c6
-rw-r--r--sound/pci/emu10k1/emu10k1x.c6
-rw-r--r--sound/pci/ens1370.c6
-rw-r--r--sound/pci/es1938.c6
-rw-r--r--sound/pci/es1968.c6
-rw-r--r--sound/pci/fm801.c6
-rw-r--r--sound/pci/hda/hda_intel.c45
-rw-r--r--sound/pci/hda/patch_sigmatel.c6
-rw-r--r--sound/pci/ice1712/ice1712.c6
-rw-r--r--sound/pci/ice1712/ice1724.c6
-rw-r--r--sound/pci/intel8x0.c6
-rw-r--r--sound/pci/intel8x0m.c6
-rw-r--r--sound/pci/korg1212/korg1212.c6
-rw-r--r--sound/pci/maestro3.c6
-rw-r--r--sound/pci/mixart/mixart.c7
-rw-r--r--sound/pci/mixart/mixart_hwdep.c12
-rw-r--r--sound/pci/nm256/nm256.c6
-rw-r--r--sound/pci/oxygen/oxygen_lib.c8
-rw-r--r--sound/pci/pcxhr/pcxhr.c6
-rw-r--r--sound/pci/pcxhr/pcxhr_hwdep.c12
-rw-r--r--sound/pci/riptide/riptide.c6
-rw-r--r--sound/pci/rme32.c7
-rw-r--r--sound/pci/rme96.c7
-rw-r--r--sound/pci/rme9652/hdsp.c15
-rw-r--r--sound/pci/rme9652/hdspm.c17
-rw-r--r--sound/pci/rme9652/rme9652.c8
-rw-r--r--sound/pci/sis7019.c5
-rw-r--r--sound/pci/sonicvibes.c6
-rw-r--r--sound/pci/trident/trident.c6
-rw-r--r--sound/pci/via82xx.c6
-rw-r--r--sound/pci/via82xx_modem.c6
-rw-r--r--sound/pci/vx222/vx222.c6
-rw-r--r--sound/pci/ymfpci/ymfpci.c6
-rw-r--r--sound/pcmcia/pdaudiocf/pdaudiocf.c19
-rw-r--r--sound/pcmcia/vx/vxpocket.c32
-rw-r--r--sound/ppc/powermac.c6
-rw-r--r--sound/ppc/snd_ps3.c6
-rw-r--r--sound/sh/aica.c8
-rw-r--r--sound/soc/soc-core.c8
-rw-r--r--sound/sparc/amd7930.c7
-rw-r--r--sound/sparc/cs4231.c9
-rw-r--r--sound/sparc/dbri.c8
-rw-r--r--sound/spi/at73c213.c7
-rw-r--r--sound/synth/emux/emux_hwdep.c21
-rw-r--r--sound/usb/caiaq/caiaq-device.c22
-rw-r--r--sound/usb/usbaudio.c6
-rw-r--r--sound/usb/usbmixer.c22
-rw-r--r--sound/usb/usx2y/us122l.c59
-rw-r--r--sound/usb/usx2y/usX2Yhwdep.c12
-rw-r--r--sound/usb/usx2y/usbusx2y.c52
117 files changed, 645 insertions, 645 deletions
diff --git a/sound/aoa/core/alsa.c b/sound/aoa/core/alsa.c
index 617850463582..0fa3855b4790 100644
--- a/sound/aoa/core/alsa.c
+++ b/sound/aoa/core/alsa.c
@@ -23,9 +23,10 @@ int aoa_alsa_init(char *name, struct module *mod, struct device *dev)
23 /* cannot be EEXIST due to usage in aoa_fabric_register */ 23 /* cannot be EEXIST due to usage in aoa_fabric_register */
24 return -EBUSY; 24 return -EBUSY;
25 25
26 alsa_card = snd_card_new(index, name, mod, sizeof(struct aoa_card)); 26 err = snd_card_create(index, name, mod, sizeof(struct aoa_card),
27 if (!alsa_card) 27 &alsa_card);
28 return -ENOMEM; 28 if (err < 0)
29 return err;
29 aoa_card = alsa_card->private_data; 30 aoa_card = alsa_card->private_data;
30 aoa_card->alsa_card = alsa_card; 31 aoa_card->alsa_card = alsa_card;
31 alsa_card->dev = dev; 32 alsa_card->dev = dev;
diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c
index 772901e41ecb..7fbd68fab944 100644
--- a/sound/arm/aaci.c
+++ b/sound/arm/aaci.c
@@ -995,10 +995,11 @@ static struct aaci * __devinit aaci_init_card(struct amba_device *dev)
995{ 995{
996 struct aaci *aaci; 996 struct aaci *aaci;
997 struct snd_card *card; 997 struct snd_card *card;
998 int err;
998 999
999 card = snd_card_new(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1, 1000 err = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
1000 THIS_MODULE, sizeof(struct aaci)); 1001 THIS_MODULE, sizeof(struct aaci), &card);
1001 if (card == NULL) 1002 if (err < 0)
1002 return NULL; 1003 return NULL;
1003 1004
1004 card->private_free = aaci_free_card; 1005 card->private_free = aaci_free_card;
diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c
index 85cf591d4e11..7ed100c80a5f 100644
--- a/sound/arm/pxa2xx-ac97.c
+++ b/sound/arm/pxa2xx-ac97.c
@@ -173,10 +173,9 @@ static int __devinit pxa2xx_ac97_probe(struct platform_device *dev)
173 struct snd_ac97_template ac97_template; 173 struct snd_ac97_template ac97_template;
174 int ret; 174 int ret;
175 175
176 ret = -ENOMEM; 176 ret = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
177 card = snd_card_new(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1, 177 THIS_MODULE, 0, &card);
178 THIS_MODULE, 0); 178 if (ret < 0)
179 if (!card)
180 goto err; 179 goto err;
181 180
182 card->dev = &dev->dev; 181 card->dev = &dev->dev;
diff --git a/sound/arm/sa11xx-uda1341.c b/sound/arm/sa11xx-uda1341.c
index 1dcd51d81d10..51d708c31e65 100644
--- a/sound/arm/sa11xx-uda1341.c
+++ b/sound/arm/sa11xx-uda1341.c
@@ -887,9 +887,10 @@ static int __devinit sa11xx_uda1341_probe(struct platform_device *devptr)
887 struct sa11xx_uda1341 *chip; 887 struct sa11xx_uda1341 *chip;
888 888
889 /* register the soundcard */ 889 /* register the soundcard */
890 card = snd_card_new(-1, id, THIS_MODULE, sizeof(struct sa11xx_uda1341)); 890 err = snd_card_create(-1, id, THIS_MODULE,
891 if (card == NULL) 891 sizeof(struct sa11xx_uda1341), &card);
892 return -ENOMEM; 892 if (err < 0)
893 return err;
893 894
894 chip = card->private_data; 895 chip = card->private_data;
895 spin_lock_init(&chip->s[0].dma_lock); 896 spin_lock_init(&chip->s[0].dma_lock);
diff --git a/sound/core/hwdep.c b/sound/core/hwdep.c
index 195cafc5a553..a70ee7f1ed98 100644
--- a/sound/core/hwdep.c
+++ b/sound/core/hwdep.c
@@ -99,9 +99,6 @@ static int snd_hwdep_open(struct inode *inode, struct file * file)
99 if (hw == NULL) 99 if (hw == NULL)
100 return -ENODEV; 100 return -ENODEV;
101 101
102 if (!hw->ops.open)
103 return -ENXIO;
104
105 if (!try_module_get(hw->card->module)) 102 if (!try_module_get(hw->card->module))
106 return -EFAULT; 103 return -EFAULT;
107 104
@@ -113,6 +110,10 @@ static int snd_hwdep_open(struct inode *inode, struct file * file)
113 err = -EBUSY; 110 err = -EBUSY;
114 break; 111 break;
115 } 112 }
113 if (!hw->ops.open) {
114 err = 0;
115 break;
116 }
116 err = hw->ops.open(hw, file); 117 err = hw->ops.open(hw, file);
117 if (err >= 0) 118 if (err >= 0)
118 break; 119 break;
@@ -151,7 +152,7 @@ static int snd_hwdep_open(struct inode *inode, struct file * file)
151 152
152static int snd_hwdep_release(struct inode *inode, struct file * file) 153static int snd_hwdep_release(struct inode *inode, struct file * file)
153{ 154{
154 int err = -ENXIO; 155 int err = 0;
155 struct snd_hwdep *hw = file->private_data; 156 struct snd_hwdep *hw = file->private_data;
156 struct module *mod = hw->card->module; 157 struct module *mod = hw->card->module;
157 158
diff --git a/sound/core/init.c b/sound/core/init.c
index 05c6da554cbf..fd56afe846ed 100644
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -121,31 +121,44 @@ static inline int init_info_for_card(struct snd_card *card)
121#endif 121#endif
122 122
123/** 123/**
124 * snd_card_new - create and initialize a soundcard structure 124 * snd_card_create - create and initialize a soundcard structure
125 * @idx: card index (address) [0 ... (SNDRV_CARDS-1)] 125 * @idx: card index (address) [0 ... (SNDRV_CARDS-1)]
126 * @xid: card identification (ASCII string) 126 * @xid: card identification (ASCII string)
127 * @module: top level module for locking 127 * @module: top level module for locking
128 * @extra_size: allocate this extra size after the main soundcard structure 128 * @extra_size: allocate this extra size after the main soundcard structure
129 * @card_ret: the pointer to store the created card instance
129 * 130 *
130 * Creates and initializes a soundcard structure. 131 * Creates and initializes a soundcard structure.
131 * 132 *
132 * Returns kmallocated snd_card structure. Creates the ALSA control interface 133 * The function allocates snd_card instance via kzalloc with the given
133 * (which is blocked until snd_card_register function is called). 134 * space for the driver to use freely. The allocated struct is stored
135 * in the given card_ret pointer.
136 *
137 * Returns zero if successful or a negative error code.
134 */ 138 */
135struct snd_card *snd_card_new(int idx, const char *xid, 139int snd_card_create(int idx, const char *xid,
136 struct module *module, int extra_size) 140 struct module *module, int extra_size,
141 struct snd_card **card_ret)
137{ 142{
138 struct snd_card *card; 143 struct snd_card *card;
139 int err, idx2; 144 int err, idx2;
140 145
146 if (snd_BUG_ON(!card_ret))
147 return -EINVAL;
148 *card_ret = NULL;
149
141 if (extra_size < 0) 150 if (extra_size < 0)
142 extra_size = 0; 151 extra_size = 0;
143 card = kzalloc(sizeof(*card) + extra_size, GFP_KERNEL); 152 card = kzalloc(sizeof(*card) + extra_size, GFP_KERNEL);
144 if (card == NULL) 153 if (!card)
145 return NULL; 154 return -ENOMEM;
146 if (xid) { 155 if (xid) {
147 if (!snd_info_check_reserved_words(xid)) 156 if (!snd_info_check_reserved_words(xid)) {
157 snd_printk(KERN_ERR
158 "given id string '%s' is reserved.\n", xid);
159 err = -EBUSY;
148 goto __error; 160 goto __error;
161 }
149 strlcpy(card->id, xid, sizeof(card->id)); 162 strlcpy(card->id, xid, sizeof(card->id));
150 } 163 }
151 err = 0; 164 err = 0;
@@ -203,26 +216,28 @@ struct snd_card *snd_card_new(int idx, const char *xid,
203#endif 216#endif
204 /* the control interface cannot be accessed from the user space until */ 217 /* the control interface cannot be accessed from the user space until */
205 /* snd_cards_bitmask and snd_cards are set with snd_card_register */ 218 /* snd_cards_bitmask and snd_cards are set with snd_card_register */
206 if ((err = snd_ctl_create(card)) < 0) { 219 err = snd_ctl_create(card);
207 snd_printd("unable to register control minors\n"); 220 if (err < 0) {
221 snd_printk(KERN_ERR "unable to register control minors\n");
208 goto __error; 222 goto __error;
209 } 223 }
210 if ((err = snd_info_card_create(card)) < 0) { 224 err = snd_info_card_create(card);
211 snd_printd("unable to create card info\n"); 225 if (err < 0) {
226 snd_printk(KERN_ERR "unable to create card info\n");
212 goto __error_ctl; 227 goto __error_ctl;
213 } 228 }
214 if (extra_size > 0) 229 if (extra_size > 0)
215 card->private_data = (char *)card + sizeof(struct snd_card); 230 card->private_data = (char *)card + sizeof(struct snd_card);
216 return card; 231 *card_ret = card;
232 return 0;
217 233
218 __error_ctl: 234 __error_ctl:
219 snd_device_free_all(card, SNDRV_DEV_CMD_PRE); 235 snd_device_free_all(card, SNDRV_DEV_CMD_PRE);
220 __error: 236 __error:
221 kfree(card); 237 kfree(card);
222 return NULL; 238 return err;
223} 239}
224 240EXPORT_SYMBOL(snd_card_create);
225EXPORT_SYMBOL(snd_card_new);
226 241
227/* return non-zero if a card is already locked */ 242/* return non-zero if a card is already locked */
228int snd_card_locked(int card) 243int snd_card_locked(int card)
diff --git a/sound/core/jack.c b/sound/core/jack.c
index 077a85262c1c..c8254c667c62 100644
--- a/sound/core/jack.c
+++ b/sound/core/jack.c
@@ -23,6 +23,14 @@
23#include <sound/jack.h> 23#include <sound/jack.h>
24#include <sound/core.h> 24#include <sound/core.h>
25 25
26static int jack_types[] = {
27 SW_HEADPHONE_INSERT,
28 SW_MICROPHONE_INSERT,
29 SW_LINEOUT_INSERT,
30 SW_JACK_PHYSICAL_INSERT,
31 SW_VIDEOOUT_INSERT,
32};
33
26static int snd_jack_dev_free(struct snd_device *device) 34static int snd_jack_dev_free(struct snd_device *device)
27{ 35{
28 struct snd_jack *jack = device->device_data; 36 struct snd_jack *jack = device->device_data;
@@ -79,6 +87,7 @@ int snd_jack_new(struct snd_card *card, const char *id, int type,
79{ 87{
80 struct snd_jack *jack; 88 struct snd_jack *jack;
81 int err; 89 int err;
90 int i;
82 static struct snd_device_ops ops = { 91 static struct snd_device_ops ops = {
83 .dev_free = snd_jack_dev_free, 92 .dev_free = snd_jack_dev_free,
84 .dev_register = snd_jack_dev_register, 93 .dev_register = snd_jack_dev_register,
@@ -100,18 +109,10 @@ int snd_jack_new(struct snd_card *card, const char *id, int type,
100 109
101 jack->type = type; 110 jack->type = type;
102 111
103 if (type & SND_JACK_HEADPHONE) 112 for (i = 0; i < ARRAY_SIZE(jack_types); i++)
104 input_set_capability(jack->input_dev, EV_SW, 113 if (type & (1 << i))
105 SW_HEADPHONE_INSERT); 114 input_set_capability(jack->input_dev, EV_SW,
106 if (type & SND_JACK_LINEOUT) 115 jack_types[i]);
107 input_set_capability(jack->input_dev, EV_SW,
108 SW_LINEOUT_INSERT);
109 if (type & SND_JACK_MICROPHONE)
110 input_set_capability(jack->input_dev, EV_SW,
111 SW_MICROPHONE_INSERT);
112 if (type & SND_JACK_MECHANICAL)
113 input_set_capability(jack->input_dev, EV_SW,
114 SW_JACK_PHYSICAL_INSERT);
115 116
116 err = snd_device_new(card, SNDRV_DEV_JACK, jack, &ops); 117 err = snd_device_new(card, SNDRV_DEV_JACK, jack, &ops);
117 if (err < 0) 118 if (err < 0)
@@ -154,21 +155,17 @@ EXPORT_SYMBOL(snd_jack_set_parent);
154 */ 155 */
155void snd_jack_report(struct snd_jack *jack, int status) 156void snd_jack_report(struct snd_jack *jack, int status)
156{ 157{
158 int i;
159
157 if (!jack) 160 if (!jack)
158 return; 161 return;
159 162
160 if (jack->type & SND_JACK_HEADPHONE) 163 for (i = 0; i < ARRAY_SIZE(jack_types); i++) {
161 input_report_switch(jack->input_dev, SW_HEADPHONE_INSERT, 164 int testbit = 1 << i;
162 status & SND_JACK_HEADPHONE); 165 if (jack->type & testbit)
163 if (jack->type & SND_JACK_LINEOUT) 166 input_report_switch(jack->input_dev, jack_types[i],
164 input_report_switch(jack->input_dev, SW_LINEOUT_INSERT, 167 status & testbit);
165 status & SND_JACK_LINEOUT); 168 }
166 if (jack->type & SND_JACK_MICROPHONE)
167 input_report_switch(jack->input_dev, SW_MICROPHONE_INSERT,
168 status & SND_JACK_MICROPHONE);
169 if (jack->type & SND_JACK_MECHANICAL)
170 input_report_switch(jack->input_dev, SW_JACK_PHYSICAL_INSERT,
171 status & SND_JACK_MECHANICAL);
172 169
173 input_sync(jack->input_dev); 170 input_sync(jack->input_dev);
174} 171}
diff --git a/sound/core/misc.c b/sound/core/misc.c
index 38524f615d94..a9710e0c97af 100644
--- a/sound/core/misc.c
+++ b/sound/core/misc.c
@@ -95,12 +95,14 @@ snd_pci_quirk_lookup(struct pci_dev *pci, const struct snd_pci_quirk *list)
95{ 95{
96 const struct snd_pci_quirk *q; 96 const struct snd_pci_quirk *q;
97 97
98 for (q = list; q->subvendor; q++) 98 for (q = list; q->subvendor; q++) {
99 if (q->subvendor == pci->subsystem_vendor && 99 if (q->subvendor != pci->subsystem_vendor)
100 (!q->subdevice || q->subdevice == pci->subsystem_device)) 100 continue;
101 if (!q->subdevice ||
102 (pci->subsystem_device & q->subdevice_mask) == q->subdevice)
101 return q; 103 return q;
104 }
102 return NULL; 105 return NULL;
103} 106}
104
105EXPORT_SYMBOL(snd_pci_quirk_lookup); 107EXPORT_SYMBOL(snd_pci_quirk_lookup);
106#endif 108#endif
diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c
index 4690b8b5681f..e570649184e2 100644
--- a/sound/core/oss/mixer_oss.c
+++ b/sound/core/oss/mixer_oss.c
@@ -692,6 +692,9 @@ static int snd_mixer_oss_put_volume1(struct snd_mixer_oss_file *fmixer,
692 snd_mixer_oss_put_volume1_vol(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_PVOLUME], left, right); 692 snd_mixer_oss_put_volume1_vol(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_PVOLUME], left, right);
693 if (slot->present & SNDRV_MIXER_OSS_PRESENT_CVOLUME) 693 if (slot->present & SNDRV_MIXER_OSS_PRESENT_CVOLUME)
694 snd_mixer_oss_put_volume1_vol(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_CVOLUME], left, right); 694 snd_mixer_oss_put_volume1_vol(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_CVOLUME], left, right);
695 } else if (slot->present & SNDRV_MIXER_OSS_PRESENT_CVOLUME) {
696 snd_mixer_oss_put_volume1_vol(fmixer, pslot,
697 slot->numid[SNDRV_MIXER_OSS_ITEM_CVOLUME], left, right);
695 } else if (slot->present & SNDRV_MIXER_OSS_PRESENT_GVOLUME) { 698 } else if (slot->present & SNDRV_MIXER_OSS_PRESENT_GVOLUME) {
696 snd_mixer_oss_put_volume1_vol(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_GVOLUME], left, right); 699 snd_mixer_oss_put_volume1_vol(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_GVOLUME], left, right);
697 } else if (slot->present & SNDRV_MIXER_OSS_PRESENT_GLOBAL) { 700 } else if (slot->present & SNDRV_MIXER_OSS_PRESENT_GLOBAL) {
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index 0a1798eafb0b..699d2890535c 100644
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -2872,7 +2872,7 @@ static void snd_pcm_oss_proc_write(struct snd_info_entry *entry,
2872 setup = kmalloc(sizeof(*setup), GFP_KERNEL); 2872 setup = kmalloc(sizeof(*setup), GFP_KERNEL);
2873 if (! setup) { 2873 if (! setup) {
2874 buffer->error = -ENOMEM; 2874 buffer->error = -ENOMEM;
2875 mutex_lock(&pstr->oss.setup_mutex); 2875 mutex_unlock(&pstr->oss.setup_mutex);
2876 return; 2876 return;
2877 } 2877 }
2878 if (pstr->oss.setup_list == NULL) 2878 if (pstr->oss.setup_list == NULL)
@@ -2886,7 +2886,7 @@ static void snd_pcm_oss_proc_write(struct snd_info_entry *entry,
2886 if (! template.task_name) { 2886 if (! template.task_name) {
2887 kfree(setup); 2887 kfree(setup);
2888 buffer->error = -ENOMEM; 2888 buffer->error = -ENOMEM;
2889 mutex_lock(&pstr->oss.setup_mutex); 2889 mutex_unlock(&pstr->oss.setup_mutex);
2890 return; 2890 return;
2891 } 2891 }
2892 } 2892 }
diff --git a/sound/core/sgbuf.c b/sound/core/sgbuf.c
index d4564edd61d7..4e7ec2b49873 100644
--- a/sound/core/sgbuf.c
+++ b/sound/core/sgbuf.c
@@ -38,6 +38,10 @@ int snd_free_sgbuf_pages(struct snd_dma_buffer *dmab)
38 if (! sgbuf) 38 if (! sgbuf)
39 return -EINVAL; 39 return -EINVAL;
40 40
41 if (dmab->area)
42 vunmap(dmab->area);
43 dmab->area = NULL;
44
41 tmpb.dev.type = SNDRV_DMA_TYPE_DEV; 45 tmpb.dev.type = SNDRV_DMA_TYPE_DEV;
42 tmpb.dev.dev = sgbuf->dev; 46 tmpb.dev.dev = sgbuf->dev;
43 for (i = 0; i < sgbuf->pages; i++) { 47 for (i = 0; i < sgbuf->pages; i++) {
@@ -48,9 +52,6 @@ int snd_free_sgbuf_pages(struct snd_dma_buffer *dmab)
48 tmpb.bytes = (sgbuf->table[i].addr & ~PAGE_MASK) << PAGE_SHIFT; 52 tmpb.bytes = (sgbuf->table[i].addr & ~PAGE_MASK) << PAGE_SHIFT;
49 snd_dma_free_pages(&tmpb); 53 snd_dma_free_pages(&tmpb);
50 } 54 }
51 if (dmab->area)
52 vunmap(dmab->area);
53 dmab->area = NULL;
54 55
55 kfree(sgbuf->table); 56 kfree(sgbuf->table);
56 kfree(sgbuf->page_table); 57 kfree(sgbuf->page_table);
diff --git a/sound/drivers/dummy.c b/sound/drivers/dummy.c
index 73be7e14a603..54239d2e0997 100644
--- a/sound/drivers/dummy.c
+++ b/sound/drivers/dummy.c
@@ -588,10 +588,10 @@ static int __devinit snd_dummy_probe(struct platform_device *devptr)
588 int idx, err; 588 int idx, err;
589 int dev = devptr->id; 589 int dev = devptr->id;
590 590
591 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 591 err = snd_card_create(index[dev], id[dev], THIS_MODULE,
592 sizeof(struct snd_dummy)); 592 sizeof(struct snd_dummy), &card);
593 if (card == NULL) 593 if (err < 0)
594 return -ENOMEM; 594 return err;
595 dummy = card->private_data; 595 dummy = card->private_data;
596 dummy->card = card; 596 dummy->card = card;
597 for (idx = 0; idx < MAX_PCM_DEVICES && idx < pcm_devs[dev]; idx++) { 597 for (idx = 0; idx < MAX_PCM_DEVICES && idx < pcm_devs[dev]; idx++) {
diff --git a/sound/drivers/ml403-ac97cr.c b/sound/drivers/ml403-ac97cr.c
index 7783843ca9ae..1950ffce2b54 100644
--- a/sound/drivers/ml403-ac97cr.c
+++ b/sound/drivers/ml403-ac97cr.c
@@ -1279,9 +1279,9 @@ static int __devinit snd_ml403_ac97cr_probe(struct platform_device *pfdev)
1279 if (!enable[dev]) 1279 if (!enable[dev])
1280 return -ENOENT; 1280 return -ENOENT;
1281 1281
1282 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 1282 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
1283 if (card == NULL) 1283 if (err < 0)
1284 return -ENOMEM; 1284 return err;
1285 err = snd_ml403_ac97cr_create(card, pfdev, &ml403_ac97cr); 1285 err = snd_ml403_ac97cr_create(card, pfdev, &ml403_ac97cr);
1286 if (err < 0) { 1286 if (err < 0) {
1287 PDEBUG(INIT_FAILURE, "probe(): create failed!\n"); 1287 PDEBUG(INIT_FAILURE, "probe(): create failed!\n");
diff --git a/sound/drivers/mpu401/mpu401.c b/sound/drivers/mpu401/mpu401.c
index 5b996f3faba5..149d05a8202d 100644
--- a/sound/drivers/mpu401/mpu401.c
+++ b/sound/drivers/mpu401/mpu401.c
@@ -73,9 +73,9 @@ static int snd_mpu401_create(int dev, struct snd_card **rcard)
73 snd_printk(KERN_ERR "the uart_enter option is obsolete; remove it\n"); 73 snd_printk(KERN_ERR "the uart_enter option is obsolete; remove it\n");
74 74
75 *rcard = NULL; 75 *rcard = NULL;
76 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 76 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
77 if (card == NULL) 77 if (err < 0)
78 return -ENOMEM; 78 return err;
79 strcpy(card->driver, "MPU-401 UART"); 79 strcpy(card->driver, "MPU-401 UART");
80 strcpy(card->shortname, card->driver); 80 strcpy(card->shortname, card->driver);
81 sprintf(card->longname, "%s at %#lx, ", card->shortname, port[dev]); 81 sprintf(card->longname, "%s at %#lx, ", card->shortname, port[dev]);
diff --git a/sound/drivers/mtpav.c b/sound/drivers/mtpav.c
index 48b64e6b2670..0e17d2b5ce19 100644
--- a/sound/drivers/mtpav.c
+++ b/sound/drivers/mtpav.c
@@ -696,9 +696,9 @@ static int __devinit snd_mtpav_probe(struct platform_device *dev)
696 int err; 696 int err;
697 struct mtpav *mtp_card; 697 struct mtpav *mtp_card;
698 698
699 card = snd_card_new(index, id, THIS_MODULE, sizeof(*mtp_card)); 699 err = snd_card_create(index, id, THIS_MODULE, sizeof(*mtp_card), &card);
700 if (! card) 700 if (err < 0)
701 return -ENOMEM; 701 return err;
702 702
703 mtp_card = card->private_data; 703 mtp_card = card->private_data;
704 spin_lock_init(&mtp_card->spinlock); 704 spin_lock_init(&mtp_card->spinlock);
diff --git a/sound/drivers/mts64.c b/sound/drivers/mts64.c
index 87ba1ddc0115..33d9db782e07 100644
--- a/sound/drivers/mts64.c
+++ b/sound/drivers/mts64.c
@@ -957,10 +957,10 @@ static int __devinit snd_mts64_probe(struct platform_device *pdev)
957 if ((err = snd_mts64_probe_port(p)) < 0) 957 if ((err = snd_mts64_probe_port(p)) < 0)
958 return err; 958 return err;
959 959
960 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 960 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
961 if (card == NULL) { 961 if (err < 0) {
962 snd_printd("Cannot create card\n"); 962 snd_printd("Cannot create card\n");
963 return -ENOMEM; 963 return err;
964 } 964 }
965 strcpy(card->driver, DRIVER_NAME); 965 strcpy(card->driver, DRIVER_NAME);
966 strcpy(card->shortname, "ESI " CARD_NAME); 966 strcpy(card->shortname, "ESI " CARD_NAME);
diff --git a/sound/drivers/pcsp/pcsp.c b/sound/drivers/pcsp/pcsp.c
index a4049eb94d35..aa2ae07a76d5 100644
--- a/sound/drivers/pcsp/pcsp.c
+++ b/sound/drivers/pcsp/pcsp.c
@@ -98,9 +98,9 @@ static int __devinit snd_card_pcsp_probe(int devnum, struct device *dev)
98 hrtimer_init(&pcsp_chip.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); 98 hrtimer_init(&pcsp_chip.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
99 pcsp_chip.timer.function = pcsp_do_timer; 99 pcsp_chip.timer.function = pcsp_do_timer;
100 100
101 card = snd_card_new(index, id, THIS_MODULE, 0); 101 err = snd_card_create(index, id, THIS_MODULE, 0, &card);
102 if (!card) 102 if (err < 0)
103 return -ENOMEM; 103 return err;
104 104
105 err = snd_pcsp_create(card); 105 err = snd_pcsp_create(card);
106 if (err < 0) { 106 if (err < 0) {
diff --git a/sound/drivers/portman2x4.c b/sound/drivers/portman2x4.c
index b1c047ec19af..60158e2e0eaf 100644
--- a/sound/drivers/portman2x4.c
+++ b/sound/drivers/portman2x4.c
@@ -746,10 +746,10 @@ static int __devinit snd_portman_probe(struct platform_device *pdev)
746 if ((err = snd_portman_probe_port(p)) < 0) 746 if ((err = snd_portman_probe_port(p)) < 0)
747 return err; 747 return err;
748 748
749 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 749 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
750 if (card == NULL) { 750 if (err < 0) {
751 snd_printd("Cannot create card\n"); 751 snd_printd("Cannot create card\n");
752 return -ENOMEM; 752 return err;
753 } 753 }
754 strcpy(card->driver, DRIVER_NAME); 754 strcpy(card->driver, DRIVER_NAME);
755 strcpy(card->shortname, CARD_NAME); 755 strcpy(card->shortname, CARD_NAME);
diff --git a/sound/drivers/serial-u16550.c b/sound/drivers/serial-u16550.c
index d8aab9da97c2..891d081e4825 100644
--- a/sound/drivers/serial-u16550.c
+++ b/sound/drivers/serial-u16550.c
@@ -936,9 +936,9 @@ static int __devinit snd_serial_probe(struct platform_device *devptr)
936 return -ENODEV; 936 return -ENODEV;
937 } 937 }
938 938
939 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 939 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
940 if (card == NULL) 940 if (err < 0)
941 return -ENOMEM; 941 return err;
942 942
943 strcpy(card->driver, "Serial"); 943 strcpy(card->driver, "Serial");
944 strcpy(card->shortname, "Serial MIDI (UART16550A)"); 944 strcpy(card->shortname, "Serial MIDI (UART16550A)");
diff --git a/sound/drivers/virmidi.c b/sound/drivers/virmidi.c
index f79e3614079d..6f48711818f3 100644
--- a/sound/drivers/virmidi.c
+++ b/sound/drivers/virmidi.c
@@ -90,10 +90,10 @@ static int __devinit snd_virmidi_probe(struct platform_device *devptr)
90 int idx, err; 90 int idx, err;
91 int dev = devptr->id; 91 int dev = devptr->id;
92 92
93 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 93 err = snd_card_create(index[dev], id[dev], THIS_MODULE,
94 sizeof(struct snd_card_virmidi)); 94 sizeof(struct snd_card_virmidi), &card);
95 if (card == NULL) 95 if (err < 0)
96 return -ENOMEM; 96 return err;
97 vmidi = (struct snd_card_virmidi *)card->private_data; 97 vmidi = (struct snd_card_virmidi *)card->private_data;
98 vmidi->card = card; 98 vmidi->card = card;
99 99
diff --git a/sound/drivers/vx/vx_hwdep.c b/sound/drivers/vx/vx_hwdep.c
index 8d6362e2d4c9..46df8817c18f 100644
--- a/sound/drivers/vx/vx_hwdep.c
+++ b/sound/drivers/vx/vx_hwdep.c
@@ -119,16 +119,6 @@ void snd_vx_free_firmware(struct vx_core *chip)
119 119
120#else /* old style firmware loading */ 120#else /* old style firmware loading */
121 121
122static int vx_hwdep_open(struct snd_hwdep *hw, struct file *file)
123{
124 return 0;
125}
126
127static int vx_hwdep_release(struct snd_hwdep *hw, struct file *file)
128{
129 return 0;
130}
131
132static int vx_hwdep_dsp_status(struct snd_hwdep *hw, 122static int vx_hwdep_dsp_status(struct snd_hwdep *hw,
133 struct snd_hwdep_dsp_status *info) 123 struct snd_hwdep_dsp_status *info)
134{ 124{
@@ -243,8 +233,6 @@ int snd_vx_setup_firmware(struct vx_core *chip)
243 233
244 hw->iface = SNDRV_HWDEP_IFACE_VX; 234 hw->iface = SNDRV_HWDEP_IFACE_VX;
245 hw->private_data = chip; 235 hw->private_data = chip;
246 hw->ops.open = vx_hwdep_open;
247 hw->ops.release = vx_hwdep_release;
248 hw->ops.dsp_status = vx_hwdep_dsp_status; 236 hw->ops.dsp_status = vx_hwdep_dsp_status;
249 hw->ops.dsp_load = vx_hwdep_dsp_load; 237 hw->ops.dsp_load = vx_hwdep_dsp_load;
250 hw->exclusive = 1; 238 hw->exclusive = 1;
diff --git a/sound/isa/ad1816a/ad1816a.c b/sound/isa/ad1816a/ad1816a.c
index 77524244a846..9660e598232c 100644
--- a/sound/isa/ad1816a/ad1816a.c
+++ b/sound/isa/ad1816a/ad1816a.c
@@ -157,9 +157,10 @@ static int __devinit snd_card_ad1816a_probe(int dev, struct pnp_card_link *pcard
157 struct snd_ad1816a *chip; 157 struct snd_ad1816a *chip;
158 struct snd_opl3 *opl3; 158 struct snd_opl3 *opl3;
159 159
160 if ((card = snd_card_new(index[dev], id[dev], THIS_MODULE, 160 error = snd_card_create(index[dev], id[dev], THIS_MODULE,
161 sizeof(struct snd_card_ad1816a))) == NULL) 161 sizeof(struct snd_card_ad1816a), &card);
162 return -ENOMEM; 162 if (error < 0)
163 return error;
163 acard = (struct snd_card_ad1816a *)card->private_data; 164 acard = (struct snd_card_ad1816a *)card->private_data;
164 165
165 if ((error = snd_card_ad1816a_pnp(dev, acard, pcard, pid))) { 166 if ((error = snd_card_ad1816a_pnp(dev, acard, pcard, pid))) {
diff --git a/sound/isa/ad1848/ad1848.c b/sound/isa/ad1848/ad1848.c
index 223a6c038819..4beeb6f98e0e 100644
--- a/sound/isa/ad1848/ad1848.c
+++ b/sound/isa/ad1848/ad1848.c
@@ -91,9 +91,9 @@ static int __devinit snd_ad1848_probe(struct device *dev, unsigned int n)
91 struct snd_pcm *pcm; 91 struct snd_pcm *pcm;
92 int error; 92 int error;
93 93
94 card = snd_card_new(index[n], id[n], THIS_MODULE, 0); 94 error = snd_card_create(index[n], id[n], THIS_MODULE, 0, &card);
95 if (!card) 95 if (error < 0)
96 return -EINVAL; 96 return error;
97 97
98 error = snd_wss_create(card, port[n], -1, irq[n], dma1[n], -1, 98 error = snd_wss_create(card, port[n], -1, irq[n], dma1[n], -1,
99 thinkpad[n] ? WSS_HW_THINKPAD : WSS_HW_DETECT, 99 thinkpad[n] ? WSS_HW_THINKPAD : WSS_HW_DETECT,
diff --git a/sound/isa/adlib.c b/sound/isa/adlib.c
index 374b7177e111..7465ae036e0b 100644
--- a/sound/isa/adlib.c
+++ b/sound/isa/adlib.c
@@ -53,10 +53,10 @@ static int __devinit snd_adlib_probe(struct device *dev, unsigned int n)
53 struct snd_opl3 *opl3; 53 struct snd_opl3 *opl3;
54 int error; 54 int error;
55 55
56 card = snd_card_new(index[n], id[n], THIS_MODULE, 0); 56 error = snd_card_create(index[n], id[n], THIS_MODULE, 0, &card);
57 if (!card) { 57 if (error < 0) {
58 dev_err(dev, "could not create card\n"); 58 dev_err(dev, "could not create card\n");
59 return -EINVAL; 59 return error;
60 } 60 }
61 61
62 card->private_data = request_region(port[n], 4, CRD_NAME); 62 card->private_data = request_region(port[n], 4, CRD_NAME);
diff --git a/sound/isa/als100.c b/sound/isa/als100.c
index f1ce30f379c9..5fd52e4d7079 100644
--- a/sound/isa/als100.c
+++ b/sound/isa/als100.c
@@ -163,9 +163,10 @@ static int __devinit snd_card_als100_probe(int dev,
163 struct snd_card_als100 *acard; 163 struct snd_card_als100 *acard;
164 struct snd_opl3 *opl3; 164 struct snd_opl3 *opl3;
165 165
166 if ((card = snd_card_new(index[dev], id[dev], THIS_MODULE, 166 error = snd_card_create(index[dev], id[dev], THIS_MODULE,
167 sizeof(struct snd_card_als100))) == NULL) 167 sizeof(struct snd_card_als100), &card);
168 return -ENOMEM; 168 if (error < 0)
169 return error;
169 acard = card->private_data; 170 acard = card->private_data;
170 171
171 if ((error = snd_card_als100_pnp(dev, acard, pcard, pid))) { 172 if ((error = snd_card_als100_pnp(dev, acard, pcard, pid))) {
diff --git a/sound/isa/azt2320.c b/sound/isa/azt2320.c
index 3e74d1a3928e..f7aa637b0d18 100644
--- a/sound/isa/azt2320.c
+++ b/sound/isa/azt2320.c
@@ -184,9 +184,10 @@ static int __devinit snd_card_azt2320_probe(int dev,
184 struct snd_wss *chip; 184 struct snd_wss *chip;
185 struct snd_opl3 *opl3; 185 struct snd_opl3 *opl3;
186 186
187 if ((card = snd_card_new(index[dev], id[dev], THIS_MODULE, 187 error = snd_card_create(index[dev], id[dev], THIS_MODULE,
188 sizeof(struct snd_card_azt2320))) == NULL) 188 sizeof(struct snd_card_azt2320), &card);
189 return -ENOMEM; 189 if (error < 0)
190 return error;
190 acard = (struct snd_card_azt2320 *)card->private_data; 191 acard = (struct snd_card_azt2320 *)card->private_data;
191 192
192 if ((error = snd_card_azt2320_pnp(dev, acard, pcard, pid))) { 193 if ((error = snd_card_azt2320_pnp(dev, acard, pcard, pid))) {
diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c
index e49aec700a55..24e60902f8ca 100644
--- a/sound/isa/cmi8330.c
+++ b/sound/isa/cmi8330.c
@@ -467,20 +467,22 @@ static int snd_cmi8330_resume(struct snd_card *card)
467 467
468#define PFX "cmi8330: " 468#define PFX "cmi8330: "
469 469
470static struct snd_card *snd_cmi8330_card_new(int dev) 470static int snd_cmi8330_card_new(int dev, struct snd_card **cardp)
471{ 471{
472 struct snd_card *card; 472 struct snd_card *card;
473 struct snd_cmi8330 *acard; 473 struct snd_cmi8330 *acard;
474 int err;
474 475
475 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 476 err = snd_card_create(index[dev], id[dev], THIS_MODULE,
476 sizeof(struct snd_cmi8330)); 477 sizeof(struct snd_cmi8330), &card);
477 if (card == NULL) { 478 if (err < 0) {
478 snd_printk(KERN_ERR PFX "could not get a new card\n"); 479 snd_printk(KERN_ERR PFX "could not get a new card\n");
479 return NULL; 480 return err;
480 } 481 }
481 acard = card->private_data; 482 acard = card->private_data;
482 acard->card = card; 483 acard->card = card;
483 return card; 484 *cardp = card;
485 return 0;
484} 486}
485 487
486static int __devinit snd_cmi8330_probe(struct snd_card *card, int dev) 488static int __devinit snd_cmi8330_probe(struct snd_card *card, int dev)
@@ -564,9 +566,9 @@ static int __devinit snd_cmi8330_isa_probe(struct device *pdev,
564 struct snd_card *card; 566 struct snd_card *card;
565 int err; 567 int err;
566 568
567 card = snd_cmi8330_card_new(dev); 569 err = snd_cmi8330_card_new(dev, &card);
568 if (! card) 570 if (err < 0)
569 return -ENOMEM; 571 return err;
570 snd_card_set_dev(card, pdev); 572 snd_card_set_dev(card, pdev);
571 if ((err = snd_cmi8330_probe(card, dev)) < 0) { 573 if ((err = snd_cmi8330_probe(card, dev)) < 0) {
572 snd_card_free(card); 574 snd_card_free(card);
@@ -628,9 +630,9 @@ static int __devinit snd_cmi8330_pnp_detect(struct pnp_card_link *pcard,
628 if (dev >= SNDRV_CARDS) 630 if (dev >= SNDRV_CARDS)
629 return -ENODEV; 631 return -ENODEV;
630 632
631 card = snd_cmi8330_card_new(dev); 633 res = snd_cmi8330_card_new(dev, &card);
632 if (! card) 634 if (res < 0)
633 return -ENOMEM; 635 return res;
634 if ((res = snd_cmi8330_pnp(dev, card->private_data, pcard, pid)) < 0) { 636 if ((res = snd_cmi8330_pnp(dev, card->private_data, pcard, pid)) < 0) {
635 snd_printk(KERN_ERR PFX "PnP detection failed\n"); 637 snd_printk(KERN_ERR PFX "PnP detection failed\n");
636 snd_card_free(card); 638 snd_card_free(card);
diff --git a/sound/isa/cs423x/cs4231.c b/sound/isa/cs423x/cs4231.c
index f019d449e2d6..cb9153e75b82 100644
--- a/sound/isa/cs423x/cs4231.c
+++ b/sound/isa/cs423x/cs4231.c
@@ -95,9 +95,9 @@ static int __devinit snd_cs4231_probe(struct device *dev, unsigned int n)
95 struct snd_pcm *pcm; 95 struct snd_pcm *pcm;
96 int error; 96 int error;
97 97
98 card = snd_card_new(index[n], id[n], THIS_MODULE, 0); 98 error = snd_card_create(index[n], id[n], THIS_MODULE, 0, &card);
99 if (!card) 99 if (error < 0)
100 return -EINVAL; 100 return error;
101 101
102 error = snd_wss_create(card, port[n], -1, irq[n], dma1[n], dma2[n], 102 error = snd_wss_create(card, port[n], -1, irq[n], dma1[n], dma2[n],
103 WSS_HW_DETECT, 0, &chip); 103 WSS_HW_DETECT, 0, &chip);
diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c
index 019c9401663e..f7845986f467 100644
--- a/sound/isa/cs423x/cs4236.c
+++ b/sound/isa/cs423x/cs4236.c
@@ -382,16 +382,18 @@ static void snd_card_cs4236_free(struct snd_card *card)
382 release_and_free_resource(acard->res_sb_port); 382 release_and_free_resource(acard->res_sb_port);
383} 383}
384 384
385static struct snd_card *snd_cs423x_card_new(int dev) 385static int snd_cs423x_card_new(int dev, struct snd_card **cardp)
386{ 386{
387 struct snd_card *card; 387 struct snd_card *card;
388 int err;
388 389
389 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 390 err = snd_card_create(index[dev], id[dev], THIS_MODULE,
390 sizeof(struct snd_card_cs4236)); 391 sizeof(struct snd_card_cs4236), &card);
391 if (card == NULL) 392 if (err < 0)
392 return NULL; 393 return err;
393 card->private_free = snd_card_cs4236_free; 394 card->private_free = snd_card_cs4236_free;
394 return card; 395 *cardp = card;
396 return 0;
395} 397}
396 398
397static int __devinit snd_cs423x_probe(struct snd_card *card, int dev) 399static int __devinit snd_cs423x_probe(struct snd_card *card, int dev)
@@ -512,9 +514,9 @@ static int __devinit snd_cs423x_isa_probe(struct device *pdev,
512 struct snd_card *card; 514 struct snd_card *card;
513 int err; 515 int err;
514 516
515 card = snd_cs423x_card_new(dev); 517 err = snd_cs423x_card_new(dev, &card);
516 if (! card) 518 if (err < 0)
517 return -ENOMEM; 519 return err;
518 snd_card_set_dev(card, pdev); 520 snd_card_set_dev(card, pdev);
519 if ((err = snd_cs423x_probe(card, dev)) < 0) { 521 if ((err = snd_cs423x_probe(card, dev)) < 0) {
520 snd_card_free(card); 522 snd_card_free(card);
@@ -594,9 +596,9 @@ static int __devinit snd_cs4232_pnpbios_detect(struct pnp_dev *pdev,
594 if (dev >= SNDRV_CARDS) 596 if (dev >= SNDRV_CARDS)
595 return -ENODEV; 597 return -ENODEV;
596 598
597 card = snd_cs423x_card_new(dev); 599 err = snd_cs423x_card_new(dev, &card);
598 if (! card) 600 if (err < 0)
599 return -ENOMEM; 601 return err;
600 if ((err = snd_card_cs4232_pnp(dev, card->private_data, pdev)) < 0) { 602 if ((err = snd_card_cs4232_pnp(dev, card->private_data, pdev)) < 0) {
601 printk(KERN_ERR "PnP BIOS detection failed for " IDENT "\n"); 603 printk(KERN_ERR "PnP BIOS detection failed for " IDENT "\n");
602 snd_card_free(card); 604 snd_card_free(card);
@@ -656,9 +658,9 @@ static int __devinit snd_cs423x_pnpc_detect(struct pnp_card_link *pcard,
656 if (dev >= SNDRV_CARDS) 658 if (dev >= SNDRV_CARDS)
657 return -ENODEV; 659 return -ENODEV;
658 660
659 card = snd_cs423x_card_new(dev); 661 res = snd_cs423x_card_new(dev, &card);
660 if (! card) 662 if (res < 0)
661 return -ENOMEM; 663 return res;
662 if ((res = snd_card_cs423x_pnpc(dev, card->private_data, pcard, pid)) < 0) { 664 if ((res = snd_card_cs423x_pnpc(dev, card->private_data, pcard, pid)) < 0) {
663 printk(KERN_ERR "isapnp detection failed and probing for " IDENT 665 printk(KERN_ERR "isapnp detection failed and probing for " IDENT
664 " is not supported\n"); 666 " is not supported\n");
diff --git a/sound/isa/dt019x.c b/sound/isa/dt019x.c
index a0242c3b613e..80f5b1af9be8 100644
--- a/sound/isa/dt019x.c
+++ b/sound/isa/dt019x.c
@@ -150,9 +150,10 @@ static int __devinit snd_card_dt019x_probe(int dev, struct pnp_card_link *pcard,
150 struct snd_card_dt019x *acard; 150 struct snd_card_dt019x *acard;
151 struct snd_opl3 *opl3; 151 struct snd_opl3 *opl3;
152 152
153 if ((card = snd_card_new(index[dev], id[dev], THIS_MODULE, 153 error = snd_card_create(index[dev], id[dev], THIS_MODULE,
154 sizeof(struct snd_card_dt019x))) == NULL) 154 sizeof(struct snd_card_dt019x), &card);
155 return -ENOMEM; 155 if (error < 0)
156 return error;
156 acard = card->private_data; 157 acard = card->private_data;
157 158
158 snd_card_set_dev(card, &pcard->card->dev); 159 snd_card_set_dev(card, &pcard->card->dev);
diff --git a/sound/isa/es1688/es1688.c b/sound/isa/es1688/es1688.c
index b46377139cf8..d746750410ea 100644
--- a/sound/isa/es1688/es1688.c
+++ b/sound/isa/es1688/es1688.c
@@ -122,9 +122,9 @@ static int __devinit snd_es1688_probe(struct device *dev, unsigned int n)
122 struct snd_pcm *pcm; 122 struct snd_pcm *pcm;
123 int error; 123 int error;
124 124
125 card = snd_card_new(index[n], id[n], THIS_MODULE, 0); 125 error = snd_card_create(index[n], id[n], THIS_MODULE, 0, &card);
126 if (!card) 126 if (error < 0)
127 return -EINVAL; 127 return error;
128 128
129 error = snd_es1688_legacy_create(card, dev, n, &chip); 129 error = snd_es1688_legacy_create(card, dev, n, &chip);
130 if (error < 0) 130 if (error < 0)
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c
index 90498e4ca260..8cfbff73a835 100644
--- a/sound/isa/es18xx.c
+++ b/sound/isa/es18xx.c
@@ -2125,10 +2125,10 @@ static int __devinit snd_audiodrive_pnpc(int dev, struct snd_audiodrive *acard,
2125#define is_isapnp_selected(dev) 0 2125#define is_isapnp_selected(dev) 0
2126#endif 2126#endif
2127 2127
2128static struct snd_card *snd_es18xx_card_new(int dev) 2128static int snd_es18xx_card_new(int dev, struct snd_card **cardp)
2129{ 2129{
2130 return snd_card_new(index[dev], id[dev], THIS_MODULE, 2130 return snd_card_create(index[dev], id[dev], THIS_MODULE,
2131 sizeof(struct snd_audiodrive)); 2131 sizeof(struct snd_audiodrive), cardp);
2132} 2132}
2133 2133
2134static int __devinit snd_audiodrive_probe(struct snd_card *card, int dev) 2134static int __devinit snd_audiodrive_probe(struct snd_card *card, int dev)
@@ -2197,9 +2197,9 @@ static int __devinit snd_es18xx_isa_probe1(int dev, struct device *devptr)
2197 struct snd_card *card; 2197 struct snd_card *card;
2198 int err; 2198 int err;
2199 2199
2200 card = snd_es18xx_card_new(dev); 2200 err = snd_es18xx_card_new(dev, &card);
2201 if (! card) 2201 if (err < 0)
2202 return -ENOMEM; 2202 return err;
2203 snd_card_set_dev(card, devptr); 2203 snd_card_set_dev(card, devptr);
2204 if ((err = snd_audiodrive_probe(card, dev)) < 0) { 2204 if ((err = snd_audiodrive_probe(card, dev)) < 0) {
2205 snd_card_free(card); 2205 snd_card_free(card);
@@ -2303,9 +2303,9 @@ static int __devinit snd_audiodrive_pnp_detect(struct pnp_dev *pdev,
2303 if (dev >= SNDRV_CARDS) 2303 if (dev >= SNDRV_CARDS)
2304 return -ENODEV; 2304 return -ENODEV;
2305 2305
2306 card = snd_es18xx_card_new(dev); 2306 err = snd_es18xx_card_new(dev, &card);
2307 if (! card) 2307 if (err < 0)
2308 return -ENOMEM; 2308 return err;
2309 if ((err = snd_audiodrive_pnp(dev, card->private_data, pdev)) < 0) { 2309 if ((err = snd_audiodrive_pnp(dev, card->private_data, pdev)) < 0) {
2310 snd_card_free(card); 2310 snd_card_free(card);
2311 return err; 2311 return err;
@@ -2362,9 +2362,9 @@ static int __devinit snd_audiodrive_pnpc_detect(struct pnp_card_link *pcard,
2362 if (dev >= SNDRV_CARDS) 2362 if (dev >= SNDRV_CARDS)
2363 return -ENODEV; 2363 return -ENODEV;
2364 2364
2365 card = snd_es18xx_card_new(dev); 2365 res = snd_es18xx_card_new(dev, &card);
2366 if (! card) 2366 if (res < 0)
2367 return -ENOMEM; 2367 return res;
2368 2368
2369 if ((res = snd_audiodrive_pnpc(dev, card->private_data, pcard, pid)) < 0) { 2369 if ((res = snd_audiodrive_pnpc(dev, card->private_data, pcard, pid)) < 0) {
2370 snd_card_free(card); 2370 snd_card_free(card);
diff --git a/sound/isa/gus/gusclassic.c b/sound/isa/gus/gusclassic.c
index 426532a4d730..086b8f0e0f94 100644
--- a/sound/isa/gus/gusclassic.c
+++ b/sound/isa/gus/gusclassic.c
@@ -148,9 +148,9 @@ static int __devinit snd_gusclassic_probe(struct device *dev, unsigned int n)
148 struct snd_gus_card *gus; 148 struct snd_gus_card *gus;
149 int error; 149 int error;
150 150
151 card = snd_card_new(index[n], id[n], THIS_MODULE, 0); 151 error = snd_card_create(index[n], id[n], THIS_MODULE, 0, &card);
152 if (!card) 152 if (error < 0)
153 return -EINVAL; 153 return error;
154 154
155 if (pcm_channels[n] < 2) 155 if (pcm_channels[n] < 2)
156 pcm_channels[n] = 2; 156 pcm_channels[n] = 2;
diff --git a/sound/isa/gus/gusextreme.c b/sound/isa/gus/gusextreme.c
index 7ad4c3b41a84..180a8dea6bd9 100644
--- a/sound/isa/gus/gusextreme.c
+++ b/sound/isa/gus/gusextreme.c
@@ -241,9 +241,9 @@ static int __devinit snd_gusextreme_probe(struct device *dev, unsigned int n)
241 struct snd_opl3 *opl3; 241 struct snd_opl3 *opl3;
242 int error; 242 int error;
243 243
244 card = snd_card_new(index[n], id[n], THIS_MODULE, 0); 244 error = snd_card_create(index[n], id[n], THIS_MODULE, 0, &card);
245 if (!card) 245 if (error < 0)
246 return -EINVAL; 246 return error;
247 247
248 if (mpu_port[n] == SNDRV_AUTO_PORT) 248 if (mpu_port[n] == SNDRV_AUTO_PORT)
249 mpu_port[n] = 0; 249 mpu_port[n] = 0;
diff --git a/sound/isa/gus/gusmax.c b/sound/isa/gus/gusmax.c
index f94c1976e632..f26eac8d8110 100644
--- a/sound/isa/gus/gusmax.c
+++ b/sound/isa/gus/gusmax.c
@@ -214,10 +214,10 @@ static int __devinit snd_gusmax_probe(struct device *pdev, unsigned int dev)
214 struct snd_wss *wss; 214 struct snd_wss *wss;
215 struct snd_gusmax *maxcard; 215 struct snd_gusmax *maxcard;
216 216
217 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 217 err = snd_card_create(index[dev], id[dev], THIS_MODULE,
218 sizeof(struct snd_gusmax)); 218 sizeof(struct snd_gusmax), &card);
219 if (card == NULL) 219 if (err < 0)
220 return -ENOMEM; 220 return err;
221 card->private_free = snd_gusmax_free; 221 card->private_free = snd_gusmax_free;
222 maxcard = (struct snd_gusmax *)card->private_data; 222 maxcard = (struct snd_gusmax *)card->private_data;
223 maxcard->card = card; 223 maxcard->card = card;
diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c
index 5faecfb602d3..50e429a120da 100644
--- a/sound/isa/gus/interwave.c
+++ b/sound/isa/gus/interwave.c
@@ -626,20 +626,22 @@ static void snd_interwave_free(struct snd_card *card)
626 free_irq(iwcard->irq, (void *)iwcard); 626 free_irq(iwcard->irq, (void *)iwcard);
627} 627}
628 628
629static struct snd_card *snd_interwave_card_new(int dev) 629static int snd_interwave_card_new(int dev, struct snd_card **cardp)
630{ 630{
631 struct snd_card *card; 631 struct snd_card *card;
632 struct snd_interwave *iwcard; 632 struct snd_interwave *iwcard;
633 int err;
633 634
634 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 635 err = snd_card_create(index[dev], id[dev], THIS_MODULE,
635 sizeof(struct snd_interwave)); 636 sizeof(struct snd_interwave), &card);
636 if (card == NULL) 637 if (err < 0)
637 return NULL; 638 return err;
638 iwcard = card->private_data; 639 iwcard = card->private_data;
639 iwcard->card = card; 640 iwcard->card = card;
640 iwcard->irq = -1; 641 iwcard->irq = -1;
641 card->private_free = snd_interwave_free; 642 card->private_free = snd_interwave_free;
642 return card; 643 *cardp = card;
644 return 0;
643} 645}
644 646
645static int __devinit snd_interwave_probe(struct snd_card *card, int dev) 647static int __devinit snd_interwave_probe(struct snd_card *card, int dev)
@@ -778,9 +780,9 @@ static int __devinit snd_interwave_isa_probe1(int dev, struct device *devptr)
778 struct snd_card *card; 780 struct snd_card *card;
779 int err; 781 int err;
780 782
781 card = snd_interwave_card_new(dev); 783 err = snd_interwave_card_new(dev, &card);
782 if (! card) 784 if (err < 0)
783 return -ENOMEM; 785 return err;
784 786
785 snd_card_set_dev(card, devptr); 787 snd_card_set_dev(card, devptr);
786 if ((err = snd_interwave_probe(card, dev)) < 0) { 788 if ((err = snd_interwave_probe(card, dev)) < 0) {
@@ -876,9 +878,9 @@ static int __devinit snd_interwave_pnp_detect(struct pnp_card_link *pcard,
876 if (dev >= SNDRV_CARDS) 878 if (dev >= SNDRV_CARDS)
877 return -ENODEV; 879 return -ENODEV;
878 880
879 card = snd_interwave_card_new(dev); 881 res = snd_interwave_card_new(dev, &card);
880 if (! card) 882 if (res < 0)
881 return -ENOMEM; 883 return res;
882 884
883 if ((res = snd_interwave_pnp(dev, card->private_data, pcard, pid)) < 0) { 885 if ((res = snd_interwave_pnp(dev, card->private_data, pcard, pid)) < 0) {
884 snd_card_free(card); 886 snd_card_free(card);
diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c
index 58c972b2af03..63e51373ddc7 100644
--- a/sound/isa/opl3sa2.c
+++ b/sound/isa/opl3sa2.c
@@ -550,21 +550,27 @@ static int __devinit snd_opl3sa2_mixer(struct snd_card *card)
550#ifdef CONFIG_PM 550#ifdef CONFIG_PM
551static int snd_opl3sa2_suspend(struct snd_card *card, pm_message_t state) 551static int snd_opl3sa2_suspend(struct snd_card *card, pm_message_t state)
552{ 552{
553 struct snd_opl3sa2 *chip = card->private_data; 553 if (card) {
554 struct snd_opl3sa2 *chip = card->private_data;
554 555
555 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); 556 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
556 chip->wss->suspend(chip->wss); 557 chip->wss->suspend(chip->wss);
557 /* power down */ 558 /* power down */
558 snd_opl3sa2_write(chip, OPL3SA2_PM_CTRL, OPL3SA2_PM_D3); 559 snd_opl3sa2_write(chip, OPL3SA2_PM_CTRL, OPL3SA2_PM_D3);
560 }
559 561
560 return 0; 562 return 0;
561} 563}
562 564
563static int snd_opl3sa2_resume(struct snd_card *card) 565static int snd_opl3sa2_resume(struct snd_card *card)
564{ 566{
565 struct snd_opl3sa2 *chip = card->private_data; 567 struct snd_opl3sa2 *chip;
566 int i; 568 int i;
567 569
570 if (!card)
571 return 0;
572
573 chip = card->private_data;
568 /* power up */ 574 /* power up */
569 snd_opl3sa2_write(chip, OPL3SA2_PM_CTRL, OPL3SA2_PM_D0); 575 snd_opl3sa2_write(chip, OPL3SA2_PM_CTRL, OPL3SA2_PM_D0);
570 576
@@ -617,21 +623,24 @@ static void snd_opl3sa2_free(struct snd_card *card)
617 release_and_free_resource(chip->res_port); 623 release_and_free_resource(chip->res_port);
618} 624}
619 625
620static struct snd_card *snd_opl3sa2_card_new(int dev) 626static int snd_opl3sa2_card_new(int dev, struct snd_card **cardp)
621{ 627{
622 struct snd_card *card; 628 struct snd_card *card;
623 struct snd_opl3sa2 *chip; 629 struct snd_opl3sa2 *chip;
630 int err;
624 631
625 card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(struct snd_opl3sa2)); 632 err = snd_card_create(index[dev], id[dev], THIS_MODULE,
626 if (card == NULL) 633 sizeof(struct snd_opl3sa2), &card);
627 return NULL; 634 if (err < 0)
635 return err;
628 strcpy(card->driver, "OPL3SA2"); 636 strcpy(card->driver, "OPL3SA2");
629 strcpy(card->shortname, "Yamaha OPL3-SA2"); 637 strcpy(card->shortname, "Yamaha OPL3-SA2");
630 chip = card->private_data; 638 chip = card->private_data;
631 spin_lock_init(&chip->reg_lock); 639 spin_lock_init(&chip->reg_lock);
632 chip->irq = -1; 640 chip->irq = -1;
633 card->private_free = snd_opl3sa2_free; 641 card->private_free = snd_opl3sa2_free;
634 return card; 642 *cardp = card;
643 return 0;
635} 644}
636 645
637static int __devinit snd_opl3sa2_probe(struct snd_card *card, int dev) 646static int __devinit snd_opl3sa2_probe(struct snd_card *card, int dev)
@@ -723,9 +732,9 @@ static int __devinit snd_opl3sa2_pnp_detect(struct pnp_dev *pdev,
723 if (dev >= SNDRV_CARDS) 732 if (dev >= SNDRV_CARDS)
724 return -ENODEV; 733 return -ENODEV;
725 734
726 card = snd_opl3sa2_card_new(dev); 735 err = snd_opl3sa2_card_new(dev, &card);
727 if (! card) 736 if (err < 0)
728 return -ENOMEM; 737 return err;
729 if ((err = snd_opl3sa2_pnp(dev, card->private_data, pdev)) < 0) { 738 if ((err = snd_opl3sa2_pnp(dev, card->private_data, pdev)) < 0) {
730 snd_card_free(card); 739 snd_card_free(card);
731 return err; 740 return err;
@@ -789,9 +798,9 @@ static int __devinit snd_opl3sa2_pnp_cdetect(struct pnp_card_link *pcard,
789 if (dev >= SNDRV_CARDS) 798 if (dev >= SNDRV_CARDS)
790 return -ENODEV; 799 return -ENODEV;
791 800
792 card = snd_opl3sa2_card_new(dev); 801 err = snd_opl3sa2_card_new(dev, &card);
793 if (! card) 802 if (err < 0)
794 return -ENOMEM; 803 return err;
795 if ((err = snd_opl3sa2_pnp(dev, card->private_data, pdev)) < 0) { 804 if ((err = snd_opl3sa2_pnp(dev, card->private_data, pdev)) < 0) {
796 snd_card_free(card); 805 snd_card_free(card);
797 return err; 806 return err;
@@ -870,9 +879,9 @@ static int __devinit snd_opl3sa2_isa_probe(struct device *pdev,
870 struct snd_card *card; 879 struct snd_card *card;
871 int err; 880 int err;
872 881
873 card = snd_opl3sa2_card_new(dev); 882 err = snd_opl3sa2_card_new(dev, &card);
874 if (! card) 883 if (err < 0)
875 return -ENOMEM; 884 return err;
876 snd_card_set_dev(card, pdev); 885 snd_card_set_dev(card, pdev);
877 if ((err = snd_opl3sa2_probe(card, dev)) < 0) { 886 if ((err = snd_opl3sa2_probe(card, dev)) < 0) {
878 snd_card_free(card); 887 snd_card_free(card);
diff --git a/sound/isa/opti9xx/miro.c b/sound/isa/opti9xx/miro.c
index 440755cc0013..02e30d7c6a93 100644
--- a/sound/isa/opti9xx/miro.c
+++ b/sound/isa/opti9xx/miro.c
@@ -1228,9 +1228,10 @@ static int __devinit snd_miro_probe(struct device *devptr, unsigned int n)
1228 struct snd_pcm *pcm; 1228 struct snd_pcm *pcm;
1229 struct snd_rawmidi *rmidi; 1229 struct snd_rawmidi *rmidi;
1230 1230
1231 if (!(card = snd_card_new(index, id, THIS_MODULE, 1231 error = snd_card_create(index, id, THIS_MODULE,
1232 sizeof(struct snd_miro)))) 1232 sizeof(struct snd_miro), &card);
1233 return -ENOMEM; 1233 if (error < 0)
1234 return error;
1234 1235
1235 card->private_free = snd_card_miro_free; 1236 card->private_free = snd_card_miro_free;
1236 miro = card->private_data; 1237 miro = card->private_data;
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c
index 19706b0d8497..cd6e60a6a4ea 100644
--- a/sound/isa/opti9xx/opti92x-ad1848.c
+++ b/sound/isa/opti9xx/opti92x-ad1848.c
@@ -830,15 +830,18 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card)
830 return snd_card_register(card); 830 return snd_card_register(card);
831} 831}
832 832
833static struct snd_card *snd_opti9xx_card_new(void) 833static int snd_opti9xx_card_new(struct snd_card **cardp)
834{ 834{
835 struct snd_card *card; 835 struct snd_card *card;
836 int err;
836 837
837 card = snd_card_new(index, id, THIS_MODULE, sizeof(struct snd_opti9xx)); 838 err = snd_card_create(index, id, THIS_MODULE,
838 if (! card) 839 sizeof(struct snd_opti9xx), &card);
839 return NULL; 840 if (err < 0)
841 return err;
840 card->private_free = snd_card_opti9xx_free; 842 card->private_free = snd_card_opti9xx_free;
841 return card; 843 *cardp = card;
844 return 0;
842} 845}
843 846
844static int __devinit snd_opti9xx_isa_match(struct device *devptr, 847static int __devinit snd_opti9xx_isa_match(struct device *devptr,
@@ -903,9 +906,9 @@ static int __devinit snd_opti9xx_isa_probe(struct device *devptr,
903 } 906 }
904#endif 907#endif
905 908
906 card = snd_opti9xx_card_new(); 909 error = snd_opti9xx_card_new(&card);
907 if (! card) 910 if (error < 0)
908 return -ENOMEM; 911 return error;
909 912
910 if ((error = snd_card_opti9xx_detect(card, card->private_data)) < 0) { 913 if ((error = snd_card_opti9xx_detect(card, card->private_data)) < 0) {
911 snd_card_free(card); 914 snd_card_free(card);
@@ -950,9 +953,9 @@ static int __devinit snd_opti9xx_pnp_probe(struct pnp_card_link *pcard,
950 return -EBUSY; 953 return -EBUSY;
951 if (! isapnp) 954 if (! isapnp)
952 return -ENODEV; 955 return -ENODEV;
953 card = snd_opti9xx_card_new(); 956 error = snd_opti9xx_card_new(&card);
954 if (! card) 957 if (error < 0)
955 return -ENOMEM; 958 return error;
956 chip = card->private_data; 959 chip = card->private_data;
957 960
958 hw = snd_card_opti9xx_pnp(chip, pcard, pid); 961 hw = snd_card_opti9xx_pnp(chip, pcard, pid);
diff --git a/sound/isa/sb/es968.c b/sound/isa/sb/es968.c
index c8c8e214c843..cafc3a7316a8 100644
--- a/sound/isa/sb/es968.c
+++ b/sound/isa/sb/es968.c
@@ -108,9 +108,10 @@ static int __devinit snd_card_es968_probe(int dev,
108 struct snd_card *card; 108 struct snd_card *card;
109 struct snd_card_es968 *acard; 109 struct snd_card_es968 *acard;
110 110
111 if ((card = snd_card_new(index[dev], id[dev], THIS_MODULE, 111 error = snd_card_create(index[dev], id[dev], THIS_MODULE,
112 sizeof(struct snd_card_es968))) == NULL) 112 sizeof(struct snd_card_es968), &card);
113 return -ENOMEM; 113 if (error < 0)
114 return error;
114 acard = card->private_data; 115 acard = card->private_data;
115 if ((error = snd_card_es968_pnp(dev, acard, pcard, pid))) { 116 if ((error = snd_card_es968_pnp(dev, acard, pcard, pid))) {
116 snd_card_free(card); 117 snd_card_free(card);
diff --git a/sound/isa/sb/sb16.c b/sound/isa/sb/sb16.c
index 2c201f78ce50..519c36346dec 100644
--- a/sound/isa/sb/sb16.c
+++ b/sound/isa/sb/sb16.c
@@ -324,14 +324,18 @@ static void snd_sb16_free(struct snd_card *card)
324#define is_isapnp_selected(dev) 0 324#define is_isapnp_selected(dev) 0
325#endif 325#endif
326 326
327static struct snd_card *snd_sb16_card_new(int dev) 327static int snd_sb16_card_new(int dev, struct snd_card **cardp)
328{ 328{
329 struct snd_card *card = snd_card_new(index[dev], id[dev], THIS_MODULE, 329 struct snd_card *card;
330 sizeof(struct snd_card_sb16)); 330 int err;
331 if (card == NULL) 331
332 return NULL; 332 err = snd_card_create(index[dev], id[dev], THIS_MODULE,
333 sizeof(struct snd_card_sb16), &card);
334 if (err < 0)
335 return err;
333 card->private_free = snd_sb16_free; 336 card->private_free = snd_sb16_free;
334 return card; 337 *cardp = card;
338 return 0;
335} 339}
336 340
337static int __devinit snd_sb16_probe(struct snd_card *card, int dev) 341static int __devinit snd_sb16_probe(struct snd_card *card, int dev)
@@ -489,9 +493,9 @@ static int __devinit snd_sb16_isa_probe1(int dev, struct device *pdev)
489 struct snd_card *card; 493 struct snd_card *card;
490 int err; 494 int err;
491 495
492 card = snd_sb16_card_new(dev); 496 err = snd_sb16_card_new(dev, &card);
493 if (! card) 497 if (err < 0)
494 return -ENOMEM; 498 return err;
495 499
496 acard = card->private_data; 500 acard = card->private_data;
497 /* non-PnP FM port address is hardwired with base port address */ 501 /* non-PnP FM port address is hardwired with base port address */
@@ -610,9 +614,9 @@ static int __devinit snd_sb16_pnp_detect(struct pnp_card_link *pcard,
610 for ( ; dev < SNDRV_CARDS; dev++) { 614 for ( ; dev < SNDRV_CARDS; dev++) {
611 if (!enable[dev] || !isapnp[dev]) 615 if (!enable[dev] || !isapnp[dev])
612 continue; 616 continue;
613 card = snd_sb16_card_new(dev); 617 res = snd_sb16_card_new(dev, &card);
614 if (! card) 618 if (res < 0)
615 return -ENOMEM; 619 return res;
616 snd_card_set_dev(card, &pcard->card->dev); 620 snd_card_set_dev(card, &pcard->card->dev);
617 if ((res = snd_card_sb16_pnp(dev, card->private_data, pcard, pid)) < 0 || 621 if ((res = snd_card_sb16_pnp(dev, card->private_data, pcard, pid)) < 0 ||
618 (res = snd_sb16_probe(card, dev)) < 0) { 622 (res = snd_sb16_probe(card, dev)) < 0) {
diff --git a/sound/isa/sb/sb8.c b/sound/isa/sb/sb8.c
index ea06877be4b1..3cd57ee54660 100644
--- a/sound/isa/sb/sb8.c
+++ b/sound/isa/sb/sb8.c
@@ -103,10 +103,10 @@ static int __devinit snd_sb8_probe(struct device *pdev, unsigned int dev)
103 struct snd_opl3 *opl3; 103 struct snd_opl3 *opl3;
104 int err; 104 int err;
105 105
106 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 106 err = snd_card_create(index[dev], id[dev], THIS_MODULE,
107 sizeof(struct snd_sb8)); 107 sizeof(struct snd_sb8), &card);
108 if (card == NULL) 108 if (err < 0)
109 return -ENOMEM; 109 return err;
110 acard = card->private_data; 110 acard = card->private_data;
111 card->private_free = snd_sb8_free; 111 card->private_free = snd_sb8_free;
112 112
diff --git a/sound/isa/sc6000.c b/sound/isa/sc6000.c
index ca35924dc3b3..7a1470376c6d 100644
--- a/sound/isa/sc6000.c
+++ b/sound/isa/sc6000.c
@@ -489,9 +489,9 @@ static int __devinit snd_sc6000_probe(struct device *devptr, unsigned int dev)
489 char __iomem *vmss_port; 489 char __iomem *vmss_port;
490 490
491 491
492 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 492 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
493 if (!card) 493 if (err < 0)
494 return -ENOMEM; 494 return err;
495 495
496 if (xirq == SNDRV_AUTO_IRQ) { 496 if (xirq == SNDRV_AUTO_IRQ) {
497 xirq = snd_legacy_find_free_irq(possible_irqs); 497 xirq = snd_legacy_find_free_irq(possible_irqs);
diff --git a/sound/isa/sgalaxy.c b/sound/isa/sgalaxy.c
index 2c7503bf1271..6fe27b9d9440 100644
--- a/sound/isa/sgalaxy.c
+++ b/sound/isa/sgalaxy.c
@@ -243,9 +243,9 @@ static int __devinit snd_sgalaxy_probe(struct device *devptr, unsigned int dev)
243 struct snd_card *card; 243 struct snd_card *card;
244 struct snd_wss *chip; 244 struct snd_wss *chip;
245 245
246 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 246 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
247 if (card == NULL) 247 if (err < 0)
248 return -ENOMEM; 248 return err;
249 249
250 xirq = irq[dev]; 250 xirq = irq[dev];
251 if (xirq == SNDRV_AUTO_IRQ) { 251 if (xirq == SNDRV_AUTO_IRQ) {
diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c
index 48a16d865834..4025fb558c50 100644
--- a/sound/isa/sscape.c
+++ b/sound/isa/sscape.c
@@ -1357,10 +1357,10 @@ static int __devinit snd_sscape_probe(struct device *pdev, unsigned int dev)
1357 struct soundscape *sscape; 1357 struct soundscape *sscape;
1358 int ret; 1358 int ret;
1359 1359
1360 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 1360 ret = snd_card_create(index[dev], id[dev], THIS_MODULE,
1361 sizeof(struct soundscape)); 1361 sizeof(struct soundscape), &card);
1362 if (!card) 1362 if (ret < 0)
1363 return -ENOMEM; 1363 return ret;
1364 1364
1365 sscape = get_card_soundscape(card); 1365 sscape = get_card_soundscape(card);
1366 sscape->type = SSCAPE; 1366 sscape->type = SSCAPE;
@@ -1462,10 +1462,10 @@ static int __devinit sscape_pnp_detect(struct pnp_card_link *pcard,
1462 * Create a new ALSA sound card entry, in anticipation 1462 * Create a new ALSA sound card entry, in anticipation
1463 * of detecting our hardware ... 1463 * of detecting our hardware ...
1464 */ 1464 */
1465 card = snd_card_new(index[idx], id[idx], THIS_MODULE, 1465 ret = snd_card_create(index[idx], id[idx], THIS_MODULE,
1466 sizeof(struct soundscape)); 1466 sizeof(struct soundscape), &card);
1467 if (!card) 1467 if (ret < 0)
1468 return -ENOMEM; 1468 return ret;
1469 1469
1470 sscape = get_card_soundscape(card); 1470 sscape = get_card_soundscape(card);
1471 1471
diff --git a/sound/isa/wavefront/wavefront.c b/sound/isa/wavefront/wavefront.c
index 4c095bc7c729..95898b2b7b58 100644
--- a/sound/isa/wavefront/wavefront.c
+++ b/sound/isa/wavefront/wavefront.c
@@ -338,15 +338,16 @@ snd_wavefront_free(struct snd_card *card)
338 } 338 }
339} 339}
340 340
341static struct snd_card *snd_wavefront_card_new(int dev) 341static int snd_wavefront_card_new(int dev, struct snd_card **cardp)
342{ 342{
343 struct snd_card *card; 343 struct snd_card *card;
344 snd_wavefront_card_t *acard; 344 snd_wavefront_card_t *acard;
345 int err;
345 346
346 card = snd_card_new (index[dev], id[dev], THIS_MODULE, 347 err = snd_card_create(index[dev], id[dev], THIS_MODULE,
347 sizeof(snd_wavefront_card_t)); 348 sizeof(snd_wavefront_card_t), &card);
348 if (card == NULL) 349 if (err < 0)
349 return NULL; 350 return err;
350 351
351 acard = card->private_data; 352 acard = card->private_data;
352 acard->wavefront.irq = -1; 353 acard->wavefront.irq = -1;
@@ -357,7 +358,8 @@ static struct snd_card *snd_wavefront_card_new(int dev)
357 acard->wavefront.card = card; 358 acard->wavefront.card = card;
358 card->private_free = snd_wavefront_free; 359 card->private_free = snd_wavefront_free;
359 360
360 return card; 361 *cardp = card;
362 return 0;
361} 363}
362 364
363static int __devinit 365static int __devinit
@@ -567,9 +569,9 @@ static int __devinit snd_wavefront_isa_probe(struct device *pdev,
567 struct snd_card *card; 569 struct snd_card *card;
568 int err; 570 int err;
569 571
570 card = snd_wavefront_card_new(dev); 572 err = snd_wavefront_card_new(dev, &card);
571 if (! card) 573 if (err < 0)
572 return -ENOMEM; 574 return err;
573 snd_card_set_dev(card, pdev); 575 snd_card_set_dev(card, pdev);
574 if ((err = snd_wavefront_probe(card, dev)) < 0) { 576 if ((err = snd_wavefront_probe(card, dev)) < 0) {
575 snd_card_free(card); 577 snd_card_free(card);
@@ -616,9 +618,9 @@ static int __devinit snd_wavefront_pnp_detect(struct pnp_card_link *pcard,
616 if (dev >= SNDRV_CARDS) 618 if (dev >= SNDRV_CARDS)
617 return -ENODEV; 619 return -ENODEV;
618 620
619 card = snd_wavefront_card_new(dev); 621 res = snd_wavefront_card_new(dev, &card);
620 if (! card) 622 if (res < 0)
621 return -ENOMEM; 623 return res;
622 624
623 if (snd_wavefront_pnp (dev, card->private_data, pcard, pid) < 0) { 625 if (snd_wavefront_pnp (dev, card->private_data, pcard, pid) < 0) {
624 if (cs4232_pcm_port[dev] == SNDRV_AUTO_PORT) { 626 if (cs4232_pcm_port[dev] == SNDRV_AUTO_PORT) {
diff --git a/sound/mips/au1x00.c b/sound/mips/au1x00.c
index 1881cec11e78..99e1391b2eb4 100644
--- a/sound/mips/au1x00.c
+++ b/sound/mips/au1x00.c
@@ -636,9 +636,10 @@ au1000_init(void)
636 struct snd_card *card; 636 struct snd_card *card;
637 struct snd_au1000 *au1000; 637 struct snd_au1000 *au1000;
638 638
639 card = snd_card_new(-1, "AC97", THIS_MODULE, sizeof(struct snd_au1000)); 639 err = snd_card_create(-1, "AC97", THIS_MODULE,
640 if (card == NULL) 640 sizeof(struct snd_au1000), &card);
641 return -ENOMEM; 641 if (err < 0)
642 return err;
642 643
643 card->private_free = snd_au1000_free; 644 card->private_free = snd_au1000_free;
644 au1000 = card->private_data; 645 au1000 = card->private_data;
diff --git a/sound/mips/hal2.c b/sound/mips/hal2.c
index db495be01861..c52691c2fc46 100644
--- a/sound/mips/hal2.c
+++ b/sound/mips/hal2.c
@@ -878,9 +878,9 @@ static int __devinit hal2_probe(struct platform_device *pdev)
878 struct snd_hal2 *chip; 878 struct snd_hal2 *chip;
879 int err; 879 int err;
880 880
881 card = snd_card_new(index, id, THIS_MODULE, 0); 881 err = snd_card_create(index, id, THIS_MODULE, 0, &card);
882 if (card == NULL) 882 if (err < 0)
883 return -ENOMEM; 883 return err;
884 884
885 err = hal2_create(card, &chip); 885 err = hal2_create(card, &chip);
886 if (err < 0) { 886 if (err < 0) {
diff --git a/sound/mips/sgio2audio.c b/sound/mips/sgio2audio.c
index 4c63504348dc..66f3b48ceafc 100644
--- a/sound/mips/sgio2audio.c
+++ b/sound/mips/sgio2audio.c
@@ -936,9 +936,9 @@ static int __devinit snd_sgio2audio_probe(struct platform_device *pdev)
936 struct snd_sgio2audio *chip; 936 struct snd_sgio2audio *chip;
937 int err; 937 int err;
938 938
939 card = snd_card_new(index, id, THIS_MODULE, 0); 939 err = snd_card_create(index, id, THIS_MODULE, 0, &card);
940 if (card == NULL) 940 if (err < 0)
941 return -ENOMEM; 941 return err;
942 942
943 err = snd_sgio2audio_create(card, &chip); 943 err = snd_sgio2audio_create(card, &chip);
944 if (err < 0) { 944 if (err < 0) {
diff --git a/sound/parisc/harmony.c b/sound/parisc/harmony.c
index 41f870f8a11d..6055fd6d3b38 100644
--- a/sound/parisc/harmony.c
+++ b/sound/parisc/harmony.c
@@ -975,9 +975,9 @@ snd_harmony_probe(struct parisc_device *padev)
975 struct snd_card *card; 975 struct snd_card *card;
976 struct snd_harmony *h; 976 struct snd_harmony *h;
977 977
978 card = snd_card_new(index, id, THIS_MODULE, 0); 978 err = snd_card_create(index, id, THIS_MODULE, 0, &card);
979 if (card == NULL) 979 if (err < 0)
980 return -ENOMEM; 980 return err;
981 981
982 err = snd_harmony_create(card, padev, &h); 982 err = snd_harmony_create(card, padev, &h);
983 if (err < 0) 983 if (err < 0)
diff --git a/sound/pci/ad1889.c b/sound/pci/ad1889.c
index a7f38e63303f..d1f242bd0ac5 100644
--- a/sound/pci/ad1889.c
+++ b/sound/pci/ad1889.c
@@ -995,10 +995,10 @@ snd_ad1889_probe(struct pci_dev *pci,
995 } 995 }
996 996
997 /* (2) */ 997 /* (2) */
998 card = snd_card_new(index[devno], id[devno], THIS_MODULE, 0); 998 err = snd_card_create(index[devno], id[devno], THIS_MODULE, 0, &card);
999 /* XXX REVISIT: we can probably allocate chip in this call */ 999 /* XXX REVISIT: we can probably allocate chip in this call */
1000 if (card == NULL) 1000 if (err < 0)
1001 return -ENOMEM; 1001 return err;
1002 1002
1003 strcpy(card->driver, "AD1889"); 1003 strcpy(card->driver, "AD1889");
1004 strcpy(card->shortname, "Analog Devices AD1889"); 1004 strcpy(card->shortname, "Analog Devices AD1889");
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c
index 1a0fd65ec280..b36c551da566 100644
--- a/sound/pci/ali5451/ali5451.c
+++ b/sound/pci/ali5451/ali5451.c
@@ -2307,9 +2307,9 @@ static int __devinit snd_ali_probe(struct pci_dev *pci,
2307 2307
2308 snd_ali_printk("probe ...\n"); 2308 snd_ali_printk("probe ...\n");
2309 2309
2310 card = snd_card_new(index, id, THIS_MODULE, 0); 2310 err = snd_card_create(index, id, THIS_MODULE, 0, &card);
2311 if (!card) 2311 if (err < 0)
2312 return -ENOMEM; 2312 return err;
2313 2313
2314 err = snd_ali_create(card, pci, pcm_channels, spdif, &codec); 2314 err = snd_ali_create(card, pci, pcm_channels, spdif, &codec);
2315 if (err < 0) 2315 if (err < 0)
diff --git a/sound/pci/als300.c b/sound/pci/als300.c
index 8df6824b51cd..f557c155db48 100644
--- a/sound/pci/als300.c
+++ b/sound/pci/als300.c
@@ -812,10 +812,10 @@ static int __devinit snd_als300_probe(struct pci_dev *pci,
812 return -ENOENT; 812 return -ENOENT;
813 } 813 }
814 814
815 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 815 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
816 816
817 if (card == NULL) 817 if (err < 0)
818 return -ENOMEM; 818 return err;
819 819
820 chip_type = pci_id->driver_data; 820 chip_type = pci_id->driver_data;
821 821
diff --git a/sound/pci/als4000.c b/sound/pci/als4000.c
index ba570053d4d5..542a0c65a92c 100644
--- a/sound/pci/als4000.c
+++ b/sound/pci/als4000.c
@@ -889,12 +889,13 @@ static int __devinit snd_card_als4000_probe(struct pci_dev *pci,
889 pci_write_config_word(pci, PCI_COMMAND, word | PCI_COMMAND_IO); 889 pci_write_config_word(pci, PCI_COMMAND, word | PCI_COMMAND_IO);
890 pci_set_master(pci); 890 pci_set_master(pci);
891 891
892 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 892 err = snd_card_create(index[dev], id[dev], THIS_MODULE,
893 sizeof(*acard) /* private_data: acard */); 893 sizeof(*acard) /* private_data: acard */,
894 if (card == NULL) { 894 &card);
895 if (err < 0) {
895 pci_release_regions(pci); 896 pci_release_regions(pci);
896 pci_disable_device(pci); 897 pci_disable_device(pci);
897 return -ENOMEM; 898 return err;
898 } 899 }
899 900
900 acard = card->private_data; 901 acard = card->private_data;
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c
index 226fe8237d31..9ce8548c03e4 100644
--- a/sound/pci/atiixp.c
+++ b/sound/pci/atiixp.c
@@ -1645,9 +1645,9 @@ static int __devinit snd_atiixp_probe(struct pci_dev *pci,
1645 struct atiixp *chip; 1645 struct atiixp *chip;
1646 int err; 1646 int err;
1647 1647
1648 card = snd_card_new(index, id, THIS_MODULE, 0); 1648 err = snd_card_create(index, id, THIS_MODULE, 0, &card);
1649 if (card == NULL) 1649 if (err < 0)
1650 return -ENOMEM; 1650 return err;
1651 1651
1652 strcpy(card->driver, spdif_aclink ? "ATIIXP" : "ATIIXP-SPDMA"); 1652 strcpy(card->driver, spdif_aclink ? "ATIIXP" : "ATIIXP-SPDMA");
1653 strcpy(card->shortname, "ATI IXP"); 1653 strcpy(card->shortname, "ATI IXP");
diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c
index 0e6e5cc1c501..c3136cccc559 100644
--- a/sound/pci/atiixp_modem.c
+++ b/sound/pci/atiixp_modem.c
@@ -1288,9 +1288,9 @@ static int __devinit snd_atiixp_probe(struct pci_dev *pci,
1288 struct atiixp_modem *chip; 1288 struct atiixp_modem *chip;
1289 int err; 1289 int err;
1290 1290
1291 card = snd_card_new(index, id, THIS_MODULE, 0); 1291 err = snd_card_create(index, id, THIS_MODULE, 0, &card);
1292 if (card == NULL) 1292 if (err < 0)
1293 return -ENOMEM; 1293 return err;
1294 1294
1295 strcpy(card->driver, "ATIIXP-MODEM"); 1295 strcpy(card->driver, "ATIIXP-MODEM");
1296 strcpy(card->shortname, "ATI IXP Modem"); 1296 strcpy(card->shortname, "ATI IXP Modem");
diff --git a/sound/pci/au88x0/au88x0.c b/sound/pci/au88x0/au88x0.c
index a36d4d1fd419..9ec122383eef 100644
--- a/sound/pci/au88x0/au88x0.c
+++ b/sound/pci/au88x0/au88x0.c
@@ -250,9 +250,9 @@ snd_vortex_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
250 return -ENOENT; 250 return -ENOENT;
251 } 251 }
252 // (2) 252 // (2)
253 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 253 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
254 if (card == NULL) 254 if (err < 0)
255 return -ENOMEM; 255 return err;
256 256
257 // (3) 257 // (3)
258 if ((err = snd_vortex_create(card, pci, &chip)) < 0) { 258 if ((err = snd_vortex_create(card, pci, &chip)) < 0) {
diff --git a/sound/pci/aw2/aw2-alsa.c b/sound/pci/aw2/aw2-alsa.c
index c7c54e7748e9..8eea29fc42fe 100644
--- a/sound/pci/aw2/aw2-alsa.c
+++ b/sound/pci/aw2/aw2-alsa.c
@@ -368,9 +368,9 @@ static int __devinit snd_aw2_probe(struct pci_dev *pci,
368 } 368 }
369 369
370 /* (2) Create card instance */ 370 /* (2) Create card instance */
371 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 371 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
372 if (card == NULL) 372 if (err < 0)
373 return -ENOMEM; 373 return err;
374 374
375 /* (3) Create main component */ 375 /* (3) Create main component */
376 err = snd_aw2_create(card, pci, &chip); 376 err = snd_aw2_create(card, pci, &chip);
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c
index 333007c523a1..1df96e76c483 100644
--- a/sound/pci/azt3328.c
+++ b/sound/pci/azt3328.c
@@ -2216,9 +2216,9 @@ snd_azf3328_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
2216 return -ENOENT; 2216 return -ENOENT;
2217 } 2217 }
2218 2218
2219 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 2219 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
2220 if (card == NULL) 2220 if (err < 0)
2221 return -ENOMEM; 2221 return err;
2222 2222
2223 strcpy(card->driver, "AZF3328"); 2223 strcpy(card->driver, "AZF3328");
2224 strcpy(card->shortname, "Aztech AZF3328 (PCI168)"); 2224 strcpy(card->shortname, "Aztech AZF3328 (PCI168)");
diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c
index 1aa1c0402540..a299340519df 100644
--- a/sound/pci/bt87x.c
+++ b/sound/pci/bt87x.c
@@ -888,9 +888,9 @@ static int __devinit snd_bt87x_probe(struct pci_dev *pci,
888 return -ENOENT; 888 return -ENOENT;
889 } 889 }
890 890
891 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 891 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
892 if (!card) 892 if (err < 0)
893 return -ENOMEM; 893 return err;
894 894
895 err = snd_bt87x_create(card, pci, &chip); 895 err = snd_bt87x_create(card, pci, &chip);
896 if (err < 0) 896 if (err < 0)
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c
index 0e62205d4081..b116456e7707 100644
--- a/sound/pci/ca0106/ca0106_main.c
+++ b/sound/pci/ca0106/ca0106_main.c
@@ -1707,9 +1707,9 @@ static int __devinit snd_ca0106_probe(struct pci_dev *pci,
1707 return -ENOENT; 1707 return -ENOENT;
1708 } 1708 }
1709 1709
1710 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 1710 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
1711 if (card == NULL) 1711 if (err < 0)
1712 return -ENOMEM; 1712 return err;
1713 1713
1714 err = snd_ca0106_create(dev, card, pci, &chip); 1714 err = snd_ca0106_create(dev, card, pci, &chip);
1715 if (err < 0) 1715 if (err < 0)
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c
index 1a74ca62c314..c7899c32aba1 100644
--- a/sound/pci/cmipci.c
+++ b/sound/pci/cmipci.c
@@ -3272,9 +3272,9 @@ static int __devinit snd_cmipci_probe(struct pci_dev *pci,
3272 return -ENOENT; 3272 return -ENOENT;
3273 } 3273 }
3274 3274
3275 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 3275 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
3276 if (card == NULL) 3276 if (err < 0)
3277 return -ENOMEM; 3277 return err;
3278 3278
3279 switch (pci->device) { 3279 switch (pci->device) {
3280 case PCI_DEVICE_ID_CMEDIA_CM8738: 3280 case PCI_DEVICE_ID_CMEDIA_CM8738:
diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c
index 192e7842e181..b9b07f464631 100644
--- a/sound/pci/cs4281.c
+++ b/sound/pci/cs4281.c
@@ -1925,9 +1925,9 @@ static int __devinit snd_cs4281_probe(struct pci_dev *pci,
1925 return -ENOENT; 1925 return -ENOENT;
1926 } 1926 }
1927 1927
1928 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 1928 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
1929 if (card == NULL) 1929 if (err < 0)
1930 return -ENOMEM; 1930 return err;
1931 1931
1932 if ((err = snd_cs4281_create(card, pci, &chip, dual_codec[dev])) < 0) { 1932 if ((err = snd_cs4281_create(card, pci, &chip, dual_codec[dev])) < 0) {
1933 snd_card_free(card); 1933 snd_card_free(card);
diff --git a/sound/pci/cs46xx/cs46xx.c b/sound/pci/cs46xx/cs46xx.c
index e876b3263e46..c9b3e3d48cbc 100644
--- a/sound/pci/cs46xx/cs46xx.c
+++ b/sound/pci/cs46xx/cs46xx.c
@@ -88,9 +88,9 @@ static int __devinit snd_card_cs46xx_probe(struct pci_dev *pci,
88 return -ENOENT; 88 return -ENOENT;
89 } 89 }
90 90
91 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 91 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
92 if (card == NULL) 92 if (err < 0)
93 return -ENOMEM; 93 return err;
94 if ((err = snd_cs46xx_create(card, pci, 94 if ((err = snd_cs46xx_create(card, pci,
95 external_amp[dev], thinkpad[dev], 95 external_amp[dev], thinkpad[dev],
96 &chip)) < 0) { 96 &chip)) < 0) {
diff --git a/sound/pci/cs5530.c b/sound/pci/cs5530.c
index 6dea5b5cc774..dc464321d0f3 100644
--- a/sound/pci/cs5530.c
+++ b/sound/pci/cs5530.c
@@ -258,10 +258,10 @@ static int __devinit snd_cs5530_probe(struct pci_dev *pci,
258 return -ENOENT; 258 return -ENOENT;
259 } 259 }
260 260
261 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 261 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
262 262
263 if (card == NULL) 263 if (err < 0)
264 return -ENOMEM; 264 return err;
265 265
266 err = snd_cs5530_create(card, pci, &chip); 266 err = snd_cs5530_create(card, pci, &chip);
267 if (err < 0) { 267 if (err < 0) {
diff --git a/sound/pci/cs5535audio/cs5535audio.c b/sound/pci/cs5535audio/cs5535audio.c
index 826e6dec2e97..ac1d72e0a1e4 100644
--- a/sound/pci/cs5535audio/cs5535audio.c
+++ b/sound/pci/cs5535audio/cs5535audio.c
@@ -353,9 +353,9 @@ static int __devinit snd_cs5535audio_probe(struct pci_dev *pci,
353 return -ENOENT; 353 return -ENOENT;
354 } 354 }
355 355
356 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 356 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
357 if (card == NULL) 357 if (err < 0)
358 return -ENOMEM; 358 return err;
359 359
360 if ((err = snd_cs5535audio_create(card, pci, &cs5535au)) < 0) 360 if ((err = snd_cs5535audio_create(card, pci, &cs5535au)) < 0)
361 goto probefail_out; 361 goto probefail_out;
diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c
index 8dbc5c4ba421..9d015a76eb69 100644
--- a/sound/pci/echoaudio/echoaudio.c
+++ b/sound/pci/echoaudio/echoaudio.c
@@ -1997,9 +1997,9 @@ static int __devinit snd_echo_probe(struct pci_dev *pci,
1997 1997
1998 DE_INIT(("Echoaudio driver starting...\n")); 1998 DE_INIT(("Echoaudio driver starting...\n"));
1999 i = 0; 1999 i = 0;
2000 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 2000 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
2001 if (card == NULL) 2001 if (err < 0)
2002 return -ENOMEM; 2002 return err;
2003 2003
2004 snd_card_set_dev(card, &pci->dev); 2004 snd_card_set_dev(card, &pci->dev);
2005 2005
diff --git a/sound/pci/emu10k1/emu10k1.c b/sound/pci/emu10k1/emu10k1.c
index 8354c1a83312..c7f3b994101c 100644
--- a/sound/pci/emu10k1/emu10k1.c
+++ b/sound/pci/emu10k1/emu10k1.c
@@ -114,9 +114,9 @@ static int __devinit snd_card_emu10k1_probe(struct pci_dev *pci,
114 return -ENOENT; 114 return -ENOENT;
115 } 115 }
116 116
117 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 117 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
118 if (card == NULL) 118 if (err < 0)
119 return -ENOMEM; 119 return err;
120 if (max_buffer_size[dev] < 32) 120 if (max_buffer_size[dev] < 32)
121 max_buffer_size[dev] = 32; 121 max_buffer_size[dev] = 32;
122 else if (max_buffer_size[dev] > 1024) 122 else if (max_buffer_size[dev] > 1024)
diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c
index 5ff4dbb62dad..31542adc6b7e 100644
--- a/sound/pci/emu10k1/emu10k1x.c
+++ b/sound/pci/emu10k1/emu10k1x.c
@@ -1544,9 +1544,9 @@ static int __devinit snd_emu10k1x_probe(struct pci_dev *pci,
1544 return -ENOENT; 1544 return -ENOENT;
1545 } 1545 }
1546 1546
1547 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 1547 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
1548 if (card == NULL) 1548 if (err < 0)
1549 return -ENOMEM; 1549 return err;
1550 1550
1551 if ((err = snd_emu10k1x_create(card, pci, &chip)) < 0) { 1551 if ((err = snd_emu10k1x_create(card, pci, &chip)) < 0) {
1552 snd_card_free(card); 1552 snd_card_free(card);
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c
index 9bf95367c882..e00614cbceff 100644
--- a/sound/pci/ens1370.c
+++ b/sound/pci/ens1370.c
@@ -2409,9 +2409,9 @@ static int __devinit snd_audiopci_probe(struct pci_dev *pci,
2409 return -ENOENT; 2409 return -ENOENT;
2410 } 2410 }
2411 2411
2412 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 2412 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
2413 if (card == NULL) 2413 if (err < 0)
2414 return -ENOMEM; 2414 return err;
2415 2415
2416 if ((err = snd_ensoniq_create(card, pci, &ensoniq)) < 0) { 2416 if ((err = snd_ensoniq_create(card, pci, &ensoniq)) < 0) {
2417 snd_card_free(card); 2417 snd_card_free(card);
diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c
index 4cd9a1faaecc..34a78afc26d0 100644
--- a/sound/pci/es1938.c
+++ b/sound/pci/es1938.c
@@ -1799,9 +1799,9 @@ static int __devinit snd_es1938_probe(struct pci_dev *pci,
1799 return -ENOENT; 1799 return -ENOENT;
1800 } 1800 }
1801 1801
1802 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 1802 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
1803 if (card == NULL) 1803 if (err < 0)
1804 return -ENOMEM; 1804 return err;
1805 for (idx = 0; idx < 5; idx++) { 1805 for (idx = 0; idx < 5; idx++) {
1806 if (pci_resource_start(pci, idx) == 0 || 1806 if (pci_resource_start(pci, idx) == 0 ||
1807 !(pci_resource_flags(pci, idx) & IORESOURCE_IO)) { 1807 !(pci_resource_flags(pci, idx) & IORESOURCE_IO)) {
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c
index e9c3794bbcb8..dc97e8116141 100644
--- a/sound/pci/es1968.c
+++ b/sound/pci/es1968.c
@@ -2645,9 +2645,9 @@ static int __devinit snd_es1968_probe(struct pci_dev *pci,
2645 return -ENOENT; 2645 return -ENOENT;
2646 } 2646 }
2647 2647
2648 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 2648 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
2649 if (!card) 2649 if (err < 0)
2650 return -ENOMEM; 2650 return err;
2651 2651
2652 if (total_bufsize[dev] < 128) 2652 if (total_bufsize[dev] < 128)
2653 total_bufsize[dev] = 128; 2653 total_bufsize[dev] = 128;
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c
index c129f9e2072c..60cdb9e0b68d 100644
--- a/sound/pci/fm801.c
+++ b/sound/pci/fm801.c
@@ -1468,9 +1468,9 @@ static int __devinit snd_card_fm801_probe(struct pci_dev *pci,
1468 return -ENOENT; 1468 return -ENOENT;
1469 } 1469 }
1470 1470
1471 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 1471 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
1472 if (card == NULL) 1472 if (err < 0)
1473 return -ENOMEM; 1473 return err;
1474 if ((err = snd_fm801_create(card, pci, tea575x_tuner[dev], &chip)) < 0) { 1474 if ((err = snd_fm801_create(card, pci, tea575x_tuner[dev], &chip)) < 0) {
1475 snd_card_free(card); 1475 snd_card_free(card);
1476 return err; 1476 return err;
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 5e909e0da04b..3683978324e8 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -2059,26 +2059,31 @@ static int __devinit check_position_fix(struct azx *chip, int fix)
2059{ 2059{
2060 const struct snd_pci_quirk *q; 2060 const struct snd_pci_quirk *q;
2061 2061
2062 /* Check VIA HD Audio Controller exist */ 2062 switch (fix) {
2063 if (chip->pci->vendor == PCI_VENDOR_ID_VIA && 2063 case POS_FIX_LPIB:
2064 chip->pci->device == VIA_HDAC_DEVICE_ID) { 2064 case POS_FIX_POSBUF:
2065 return fix;
2066 }
2067
2068 /* Check VIA/ATI HD Audio Controller exist */
2069 switch (chip->driver_type) {
2070 case AZX_DRIVER_VIA:
2071 case AZX_DRIVER_ATI:
2065 chip->via_dmapos_patch = 1; 2072 chip->via_dmapos_patch = 1;
2066 /* Use link position directly, avoid any transfer problem. */ 2073 /* Use link position directly, avoid any transfer problem. */
2067 return POS_FIX_LPIB; 2074 return POS_FIX_LPIB;
2068 } 2075 }
2069 chip->via_dmapos_patch = 0; 2076 chip->via_dmapos_patch = 0;
2070 2077
2071 if (fix == POS_FIX_AUTO) { 2078 q = snd_pci_quirk_lookup(chip->pci, position_fix_list);
2072 q = snd_pci_quirk_lookup(chip->pci, position_fix_list); 2079 if (q) {
2073 if (q) { 2080 printk(KERN_INFO
2074 printk(KERN_INFO 2081 "hda_intel: position_fix set to %d "
2075 "hda_intel: position_fix set to %d " 2082 "for device %04x:%04x\n",
2076 "for device %04x:%04x\n", 2083 q->value, q->subvendor, q->subdevice);
2077 q->value, q->subvendor, q->subdevice); 2084 return q->value;
2078 return q->value;
2079 }
2080 } 2085 }
2081 return fix; 2086 return POS_FIX_AUTO;
2082} 2087}
2083 2088
2084/* 2089/*
@@ -2210,9 +2215,17 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci,
2210 gcap = azx_readw(chip, GCAP); 2215 gcap = azx_readw(chip, GCAP);
2211 snd_printdd("chipset global capabilities = 0x%x\n", gcap); 2216 snd_printdd("chipset global capabilities = 0x%x\n", gcap);
2212 2217
2218 /* ATI chips seems buggy about 64bit DMA addresses */
2219 if (chip->driver_type == AZX_DRIVER_ATI)
2220 gcap &= ~0x01;
2221
2213 /* allow 64bit DMA address if supported by H/W */ 2222 /* allow 64bit DMA address if supported by H/W */
2214 if ((gcap & 0x01) && !pci_set_dma_mask(pci, DMA_64BIT_MASK)) 2223 if ((gcap & 0x01) && !pci_set_dma_mask(pci, DMA_64BIT_MASK))
2215 pci_set_consistent_dma_mask(pci, DMA_64BIT_MASK); 2224 pci_set_consistent_dma_mask(pci, DMA_64BIT_MASK);
2225 else {
2226 pci_set_dma_mask(pci, DMA_32BIT_MASK);
2227 pci_set_consistent_dma_mask(pci, DMA_32BIT_MASK);
2228 }
2216 2229
2217 /* read number of streams from GCAP register instead of using 2230 /* read number of streams from GCAP register instead of using
2218 * hardcoded value 2231 * hardcoded value
@@ -2334,10 +2347,10 @@ static int __devinit azx_probe(struct pci_dev *pci,
2334 return -ENOENT; 2347 return -ENOENT;
2335 } 2348 }
2336 2349
2337 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 2350 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
2338 if (!card) { 2351 if (err < 0) {
2339 snd_printk(KERN_ERR SFX "Error creating card!\n"); 2352 snd_printk(KERN_ERR SFX "Error creating card!\n");
2340 return -ENOMEM; 2353 return err;
2341 } 2354 }
2342 2355
2343 err = azx_create(card, pci, dev, pci_id->driver_data, &chip); 2356 err = azx_create(card, pci, dev, pci_id->driver_data, &chip);
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 3bc427645da8..6094344fb223 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -1207,7 +1207,7 @@ static const char *slave_vols[] = {
1207 "LFE Playback Volume", 1207 "LFE Playback Volume",
1208 "Side Playback Volume", 1208 "Side Playback Volume",
1209 "Headphone Playback Volume", 1209 "Headphone Playback Volume",
1210 "Headphone Playback Volume", 1210 "Headphone2 Playback Volume",
1211 "Speaker Playback Volume", 1211 "Speaker Playback Volume",
1212 "External Speaker Playback Volume", 1212 "External Speaker Playback Volume",
1213 "Speaker2 Playback Volume", 1213 "Speaker2 Playback Volume",
@@ -1221,7 +1221,7 @@ static const char *slave_sws[] = {
1221 "LFE Playback Switch", 1221 "LFE Playback Switch",
1222 "Side Playback Switch", 1222 "Side Playback Switch",
1223 "Headphone Playback Switch", 1223 "Headphone Playback Switch",
1224 "Headphone Playback Switch", 1224 "Headphone2 Playback Switch",
1225 "Speaker Playback Switch", 1225 "Speaker Playback Switch",
1226 "External Speaker Playback Switch", 1226 "External Speaker Playback Switch",
1227 "Speaker2 Playback Switch", 1227 "Speaker2 Playback Switch",
@@ -3516,6 +3516,7 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out
3516 if (! spec->autocfg.line_outs) 3516 if (! spec->autocfg.line_outs)
3517 return 0; /* can't find valid pin config */ 3517 return 0; /* can't find valid pin config */
3518 3518
3519#if 0 /* FIXME: temporarily disabled */
3519 /* If we have no real line-out pin and multiple hp-outs, HPs should 3520 /* If we have no real line-out pin and multiple hp-outs, HPs should
3520 * be set up as multi-channel outputs. 3521 * be set up as multi-channel outputs.
3521 */ 3522 */
@@ -3535,6 +3536,7 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out
3535 spec->autocfg.line_out_type = AUTO_PIN_HP_OUT; 3536 spec->autocfg.line_out_type = AUTO_PIN_HP_OUT;
3536 spec->autocfg.hp_outs = 0; 3537 spec->autocfg.hp_outs = 0;
3537 } 3538 }
3539#endif /* FIXME: temporarily disabled */
3538 if (spec->autocfg.mono_out_pin) { 3540 if (spec->autocfg.mono_out_pin) {
3539 int dir = get_wcaps(codec, spec->autocfg.mono_out_pin) & 3541 int dir = get_wcaps(codec, spec->autocfg.mono_out_pin) &
3540 (AC_WCAP_OUT_AMP | AC_WCAP_IN_AMP); 3542 (AC_WCAP_OUT_AMP | AC_WCAP_IN_AMP);
diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c
index 58d7cda03de5..bab1c700f497 100644
--- a/sound/pci/ice1712/ice1712.c
+++ b/sound/pci/ice1712/ice1712.c
@@ -2648,9 +2648,9 @@ static int __devinit snd_ice1712_probe(struct pci_dev *pci,
2648 return -ENOENT; 2648 return -ENOENT;
2649 } 2649 }
2650 2650
2651 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 2651 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
2652 if (card == NULL) 2652 if (err < 0)
2653 return -ENOMEM; 2653 return err;
2654 2654
2655 strcpy(card->driver, "ICE1712"); 2655 strcpy(card->driver, "ICE1712");
2656 strcpy(card->shortname, "ICEnsemble ICE1712"); 2656 strcpy(card->shortname, "ICEnsemble ICE1712");
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c
index bb8d8c766b9d..7ff36d3f0f44 100644
--- a/sound/pci/ice1712/ice1724.c
+++ b/sound/pci/ice1712/ice1724.c
@@ -2456,9 +2456,9 @@ static int __devinit snd_vt1724_probe(struct pci_dev *pci,
2456 return -ENOENT; 2456 return -ENOENT;
2457 } 2457 }
2458 2458
2459 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 2459 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
2460 if (card == NULL) 2460 if (err < 0)
2461 return -ENOMEM; 2461 return err;
2462 2462
2463 strcpy(card->driver, "ICE1724"); 2463 strcpy(card->driver, "ICE1724");
2464 strcpy(card->shortname, "ICEnsemble ICE1724"); 2464 strcpy(card->shortname, "ICEnsemble ICE1724");
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
index e900cdc84849..608655e9275e 100644
--- a/sound/pci/intel8x0.c
+++ b/sound/pci/intel8x0.c
@@ -3058,9 +3058,9 @@ static int __devinit snd_intel8x0_probe(struct pci_dev *pci,
3058 int err; 3058 int err;
3059 struct shortname_table *name; 3059 struct shortname_table *name;
3060 3060
3061 card = snd_card_new(index, id, THIS_MODULE, 0); 3061 err = snd_card_create(index, id, THIS_MODULE, 0, &card);
3062 if (card == NULL) 3062 if (err < 0)
3063 return -ENOMEM; 3063 return err;
3064 3064
3065 if (spdif_aclink < 0) 3065 if (spdif_aclink < 0)
3066 spdif_aclink = check_default_spdif_aclink(pci); 3066 spdif_aclink = check_default_spdif_aclink(pci);
diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c
index 93449e464566..33a843c19316 100644
--- a/sound/pci/intel8x0m.c
+++ b/sound/pci/intel8x0m.c
@@ -1269,9 +1269,9 @@ static int __devinit snd_intel8x0m_probe(struct pci_dev *pci,
1269 int err; 1269 int err;
1270 struct shortname_table *name; 1270 struct shortname_table *name;
1271 1271
1272 card = snd_card_new(index, id, THIS_MODULE, 0); 1272 err = snd_card_create(index, id, THIS_MODULE, 0, &card);
1273 if (card == NULL) 1273 if (err < 0)
1274 return -ENOMEM; 1274 return err;
1275 1275
1276 strcpy(card->driver, "ICH-MODEM"); 1276 strcpy(card->driver, "ICH-MODEM");
1277 strcpy(card->shortname, "Intel ICH"); 1277 strcpy(card->shortname, "Intel ICH");
diff --git a/sound/pci/korg1212/korg1212.c b/sound/pci/korg1212/korg1212.c
index 5f8006b42750..8b79969034be 100644
--- a/sound/pci/korg1212/korg1212.c
+++ b/sound/pci/korg1212/korg1212.c
@@ -2443,9 +2443,9 @@ snd_korg1212_probe(struct pci_dev *pci,
2443 dev++; 2443 dev++;
2444 return -ENOENT; 2444 return -ENOENT;
2445 } 2445 }
2446 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 2446 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
2447 if (card == NULL) 2447 if (err < 0)
2448 return -ENOMEM; 2448 return err;
2449 2449
2450 if ((err = snd_korg1212_create(card, pci, &korg1212)) < 0) { 2450 if ((err = snd_korg1212_create(card, pci, &korg1212)) < 0) {
2451 snd_card_free(card); 2451 snd_card_free(card);
diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c
index 59bbaf8f3e5b..70141548f251 100644
--- a/sound/pci/maestro3.c
+++ b/sound/pci/maestro3.c
@@ -2691,9 +2691,9 @@ snd_m3_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
2691 return -ENOENT; 2691 return -ENOENT;
2692 } 2692 }
2693 2693
2694 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 2694 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
2695 if (card == NULL) 2695 if (err < 0)
2696 return -ENOMEM; 2696 return err;
2697 2697
2698 switch (pci->device) { 2698 switch (pci->device) {
2699 case PCI_DEVICE_ID_ESS_ALLEGRO: 2699 case PCI_DEVICE_ID_ESS_ALLEGRO:
diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c
index f23a73577c22..c1eb84a14c42 100644
--- a/sound/pci/mixart/mixart.c
+++ b/sound/pci/mixart/mixart.c
@@ -607,6 +607,7 @@ static int snd_mixart_hw_params(struct snd_pcm_substream *subs,
607 /* set the format to the board */ 607 /* set the format to the board */
608 err = mixart_set_format(stream, format); 608 err = mixart_set_format(stream, format);
609 if(err < 0) { 609 if(err < 0) {
610 mutex_unlock(&mgr->setup_mutex);
610 return err; 611 return err;
611 } 612 }
612 613
@@ -1365,12 +1366,12 @@ static int __devinit snd_mixart_probe(struct pci_dev *pci,
1365 else 1366 else
1366 idx = index[dev] + i; 1367 idx = index[dev] + i;
1367 snprintf(tmpid, sizeof(tmpid), "%s-%d", id[dev] ? id[dev] : "MIXART", i); 1368 snprintf(tmpid, sizeof(tmpid), "%s-%d", id[dev] ? id[dev] : "MIXART", i);
1368 card = snd_card_new(idx, tmpid, THIS_MODULE, 0); 1369 err = snd_card_create(idx, tmpid, THIS_MODULE, 0, &card);
1369 1370
1370 if (! card) { 1371 if (err < 0) {
1371 snd_printk(KERN_ERR "cannot allocate the card %d\n", i); 1372 snd_printk(KERN_ERR "cannot allocate the card %d\n", i);
1372 snd_mixart_free(mgr); 1373 snd_mixart_free(mgr);
1373 return -ENOMEM; 1374 return err;
1374 } 1375 }
1375 1376
1376 strcpy(card->driver, CARD_NAME); 1377 strcpy(card->driver, CARD_NAME);
diff --git a/sound/pci/mixart/mixart_hwdep.c b/sound/pci/mixart/mixart_hwdep.c
index 3782b52bc0e8..fa4de985fc4c 100644
--- a/sound/pci/mixart/mixart_hwdep.c
+++ b/sound/pci/mixart/mixart_hwdep.c
@@ -581,16 +581,6 @@ MODULE_FIRMWARE("mixart/miXart8AES.xlx");
581/* miXart hwdep interface id string */ 581/* miXart hwdep interface id string */
582#define SND_MIXART_HWDEP_ID "miXart Loader" 582#define SND_MIXART_HWDEP_ID "miXart Loader"
583 583
584static int mixart_hwdep_open(struct snd_hwdep *hw, struct file *file)
585{
586 return 0;
587}
588
589static int mixart_hwdep_release(struct snd_hwdep *hw, struct file *file)
590{
591 return 0;
592}
593
594static int mixart_hwdep_dsp_status(struct snd_hwdep *hw, 584static int mixart_hwdep_dsp_status(struct snd_hwdep *hw,
595 struct snd_hwdep_dsp_status *info) 585 struct snd_hwdep_dsp_status *info)
596{ 586{
@@ -643,8 +633,6 @@ int snd_mixart_setup_firmware(struct mixart_mgr *mgr)
643 633
644 hw->iface = SNDRV_HWDEP_IFACE_MIXART; 634 hw->iface = SNDRV_HWDEP_IFACE_MIXART;
645 hw->private_data = mgr; 635 hw->private_data = mgr;
646 hw->ops.open = mixart_hwdep_open;
647 hw->ops.release = mixart_hwdep_release;
648 hw->ops.dsp_status = mixart_hwdep_dsp_status; 636 hw->ops.dsp_status = mixart_hwdep_dsp_status;
649 hw->ops.dsp_load = mixart_hwdep_dsp_load; 637 hw->ops.dsp_load = mixart_hwdep_dsp_load;
650 hw->exclusive = 1; 638 hw->exclusive = 1;
diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c
index 50c9f8a05082..522a040855d4 100644
--- a/sound/pci/nm256/nm256.c
+++ b/sound/pci/nm256/nm256.c
@@ -1668,9 +1668,9 @@ static int __devinit snd_nm256_probe(struct pci_dev *pci,
1668 } 1668 }
1669 } 1669 }
1670 1670
1671 card = snd_card_new(index, id, THIS_MODULE, 0); 1671 err = snd_card_create(index, id, THIS_MODULE, 0, &card);
1672 if (card == NULL) 1672 if (err < 0)
1673 return -ENOMEM; 1673 return err;
1674 1674
1675 switch (pci->device) { 1675 switch (pci->device) {
1676 case PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO: 1676 case PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO:
diff --git a/sound/pci/oxygen/oxygen_lib.c b/sound/pci/oxygen/oxygen_lib.c
index 84f481d41efa..9c81e0b05113 100644
--- a/sound/pci/oxygen/oxygen_lib.c
+++ b/sound/pci/oxygen/oxygen_lib.c
@@ -459,10 +459,10 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id,
459 struct oxygen *chip; 459 struct oxygen *chip;
460 int err; 460 int err;
461 461
462 card = snd_card_new(index, id, model->owner, 462 err = snd_card_create(index, id, model->owner,
463 sizeof *chip + model->model_data_size); 463 sizeof(*chip) + model->model_data_size, &card);
464 if (!card) 464 if (err < 0)
465 return -ENOMEM; 465 return err;
466 466
467 chip = card->private_data; 467 chip = card->private_data;
468 chip->card = card; 468 chip->card = card;
diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c
index 27cf2c28d113..7f95459c8b1f 100644
--- a/sound/pci/pcxhr/pcxhr.c
+++ b/sound/pci/pcxhr/pcxhr.c
@@ -1510,12 +1510,12 @@ static int __devinit pcxhr_probe(struct pci_dev *pci,
1510 1510
1511 snprintf(tmpid, sizeof(tmpid), "%s-%d", 1511 snprintf(tmpid, sizeof(tmpid), "%s-%d",
1512 id[dev] ? id[dev] : card_name, i); 1512 id[dev] ? id[dev] : card_name, i);
1513 card = snd_card_new(idx, tmpid, THIS_MODULE, 0); 1513 err = snd_card_create(idx, tmpid, THIS_MODULE, 0, &card);
1514 1514
1515 if (! card) { 1515 if (err < 0) {
1516 snd_printk(KERN_ERR "cannot allocate the card %d\n", i); 1516 snd_printk(KERN_ERR "cannot allocate the card %d\n", i);
1517 pcxhr_free(mgr); 1517 pcxhr_free(mgr);
1518 return -ENOMEM; 1518 return err;
1519 } 1519 }
1520 1520
1521 strcpy(card->driver, DRIVER_NAME); 1521 strcpy(card->driver, DRIVER_NAME);
diff --git a/sound/pci/pcxhr/pcxhr_hwdep.c b/sound/pci/pcxhr/pcxhr_hwdep.c
index 592743a298b0..17cb1233a903 100644
--- a/sound/pci/pcxhr/pcxhr_hwdep.c
+++ b/sound/pci/pcxhr/pcxhr_hwdep.c
@@ -471,16 +471,6 @@ static int pcxhr_hwdep_dsp_load(struct snd_hwdep *hw,
471 return 0; 471 return 0;
472} 472}
473 473
474static int pcxhr_hwdep_open(struct snd_hwdep *hw, struct file *file)
475{
476 return 0;
477}
478
479static int pcxhr_hwdep_release(struct snd_hwdep *hw, struct file *file)
480{
481 return 0;
482}
483
484int pcxhr_setup_firmware(struct pcxhr_mgr *mgr) 474int pcxhr_setup_firmware(struct pcxhr_mgr *mgr)
485{ 475{
486 int err; 476 int err;
@@ -495,8 +485,6 @@ int pcxhr_setup_firmware(struct pcxhr_mgr *mgr)
495 485
496 hw->iface = SNDRV_HWDEP_IFACE_PCXHR; 486 hw->iface = SNDRV_HWDEP_IFACE_PCXHR;
497 hw->private_data = mgr; 487 hw->private_data = mgr;
498 hw->ops.open = pcxhr_hwdep_open;
499 hw->ops.release = pcxhr_hwdep_release;
500 hw->ops.dsp_status = pcxhr_hwdep_dsp_status; 488 hw->ops.dsp_status = pcxhr_hwdep_dsp_status;
501 hw->ops.dsp_load = pcxhr_hwdep_dsp_load; 489 hw->ops.dsp_load = pcxhr_hwdep_dsp_load;
502 hw->exclusive = 1; 490 hw->exclusive = 1;
diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c
index 3caacfb9d8e0..6f1034417a02 100644
--- a/sound/pci/riptide/riptide.c
+++ b/sound/pci/riptide/riptide.c
@@ -2102,9 +2102,9 @@ snd_card_riptide_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
2102 return -ENOENT; 2102 return -ENOENT;
2103 } 2103 }
2104 2104
2105 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 2105 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
2106 if (card == NULL) 2106 if (err < 0)
2107 return -ENOMEM; 2107 return err;
2108 if ((err = snd_riptide_create(card, pci, &chip)) < 0) { 2108 if ((err = snd_riptide_create(card, pci, &chip)) < 0) {
2109 snd_card_free(card); 2109 snd_card_free(card);
2110 return err; 2110 return err;
diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c
index e7ef3a1a25a8..d7b966e7c4cf 100644
--- a/sound/pci/rme32.c
+++ b/sound/pci/rme32.c
@@ -1941,9 +1941,10 @@ snd_rme32_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
1941 return -ENOENT; 1941 return -ENOENT;
1942 } 1942 }
1943 1943
1944 if ((card = snd_card_new(index[dev], id[dev], THIS_MODULE, 1944 err = snd_card_create(index[dev], id[dev], THIS_MODULE,
1945 sizeof(struct rme32))) == NULL) 1945 sizeof(struct rme32), &card);
1946 return -ENOMEM; 1946 if (err < 0)
1947 return err;
1947 card->private_free = snd_rme32_card_free; 1948 card->private_free = snd_rme32_card_free;
1948 rme32 = (struct rme32 *) card->private_data; 1949 rme32 = (struct rme32 *) card->private_data;
1949 rme32->card = card; 1950 rme32->card = card;
diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c
index 3fdd488d0975..55fb1c131f58 100644
--- a/sound/pci/rme96.c
+++ b/sound/pci/rme96.c
@@ -2348,9 +2348,10 @@ snd_rme96_probe(struct pci_dev *pci,
2348 dev++; 2348 dev++;
2349 return -ENOENT; 2349 return -ENOENT;
2350 } 2350 }
2351 if ((card = snd_card_new(index[dev], id[dev], THIS_MODULE, 2351 err = snd_card_create(index[dev], id[dev], THIS_MODULE,
2352 sizeof(struct rme96))) == NULL) 2352 sizeof(struct rme96), &card);
2353 return -ENOMEM; 2353 if (err < 0)
2354 return err;
2354 card->private_free = snd_rme96_card_free; 2355 card->private_free = snd_rme96_card_free;
2355 rme96 = (struct rme96 *)card->private_data; 2356 rme96 = (struct rme96 *)card->private_data;
2356 rme96->card = card; 2357 rme96->card = card;
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c
index 44d0c15e2b71..bacfdd12619b 100644
--- a/sound/pci/rme9652/hdsp.c
+++ b/sound/pci/rme9652/hdsp.c
@@ -4413,13 +4413,6 @@ static int snd_hdsp_capture_release(struct snd_pcm_substream *substream)
4413 return 0; 4413 return 0;
4414} 4414}
4415 4415
4416static int snd_hdsp_hwdep_dummy_op(struct snd_hwdep *hw, struct file *file)
4417{
4418 /* we have nothing to initialize but the call is required */
4419 return 0;
4420}
4421
4422
4423/* helper functions for copying meter values */ 4416/* helper functions for copying meter values */
4424static inline int copy_u32_le(void __user *dest, void __iomem *src) 4417static inline int copy_u32_le(void __user *dest, void __iomem *src)
4425{ 4418{
@@ -4738,9 +4731,7 @@ static int snd_hdsp_create_hwdep(struct snd_card *card, struct hdsp *hdsp)
4738 hw->private_data = hdsp; 4731 hw->private_data = hdsp;
4739 strcpy(hw->name, "HDSP hwdep interface"); 4732 strcpy(hw->name, "HDSP hwdep interface");
4740 4733
4741 hw->ops.open = snd_hdsp_hwdep_dummy_op;
4742 hw->ops.ioctl = snd_hdsp_hwdep_ioctl; 4734 hw->ops.ioctl = snd_hdsp_hwdep_ioctl;
4743 hw->ops.release = snd_hdsp_hwdep_dummy_op;
4744 4735
4745 return 0; 4736 return 0;
4746} 4737}
@@ -5158,8 +5149,10 @@ static int __devinit snd_hdsp_probe(struct pci_dev *pci,
5158 return -ENOENT; 5149 return -ENOENT;
5159 } 5150 }
5160 5151
5161 if (!(card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(struct hdsp)))) 5152 err = snd_card_create(index[dev], id[dev], THIS_MODULE,
5162 return -ENOMEM; 5153 sizeof(struct hdsp), &card);
5154 if (err < 0)
5155 return err;
5163 5156
5164 hdsp = (struct hdsp *) card->private_data; 5157 hdsp = (struct hdsp *) card->private_data;
5165 card->private_free = snd_hdsp_card_free; 5158 card->private_free = snd_hdsp_card_free;
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index 71231cf1b2b0..bac2dc0c5d85 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -4100,13 +4100,6 @@ static int snd_hdspm_capture_release(struct snd_pcm_substream *substream)
4100 return 0; 4100 return 0;
4101} 4101}
4102 4102
4103static int snd_hdspm_hwdep_dummy_op(struct snd_hwdep * hw, struct file *file)
4104{
4105 /* we have nothing to initialize but the call is required */
4106 return 0;
4107}
4108
4109
4110static int snd_hdspm_hwdep_ioctl(struct snd_hwdep * hw, struct file *file, 4103static int snd_hdspm_hwdep_ioctl(struct snd_hwdep * hw, struct file *file,
4111 unsigned int cmd, unsigned long arg) 4104 unsigned int cmd, unsigned long arg)
4112{ 4105{
@@ -4213,9 +4206,7 @@ static int __devinit snd_hdspm_create_hwdep(struct snd_card *card,
4213 hw->private_data = hdspm; 4206 hw->private_data = hdspm;
4214 strcpy(hw->name, "HDSPM hwdep interface"); 4207 strcpy(hw->name, "HDSPM hwdep interface");
4215 4208
4216 hw->ops.open = snd_hdspm_hwdep_dummy_op;
4217 hw->ops.ioctl = snd_hdspm_hwdep_ioctl; 4209 hw->ops.ioctl = snd_hdspm_hwdep_ioctl;
4218 hw->ops.release = snd_hdspm_hwdep_dummy_op;
4219 4210
4220 return 0; 4211 return 0;
4221} 4212}
@@ -4503,10 +4494,10 @@ static int __devinit snd_hdspm_probe(struct pci_dev *pci,
4503 return -ENOENT; 4494 return -ENOENT;
4504 } 4495 }
4505 4496
4506 card = snd_card_new(index[dev], id[dev], 4497 err = snd_card_create(index[dev], id[dev],
4507 THIS_MODULE, sizeof(struct hdspm)); 4498 THIS_MODULE, sizeof(struct hdspm), &card);
4508 if (!card) 4499 if (err < 0)
4509 return -ENOMEM; 4500 return err;
4510 4501
4511 hdspm = card->private_data; 4502 hdspm = card->private_data;
4512 card->private_free = snd_hdspm_card_free; 4503 card->private_free = snd_hdspm_card_free;
diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c
index 2570907134d7..bc539abb2105 100644
--- a/sound/pci/rme9652/rme9652.c
+++ b/sound/pci/rme9652/rme9652.c
@@ -2594,11 +2594,11 @@ static int __devinit snd_rme9652_probe(struct pci_dev *pci,
2594 return -ENOENT; 2594 return -ENOENT;
2595 } 2595 }
2596 2596
2597 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 2597 err = snd_card_create(index[dev], id[dev], THIS_MODULE,
2598 sizeof(struct snd_rme9652)); 2598 sizeof(struct snd_rme9652), &card);
2599 2599
2600 if (!card) 2600 if (err < 0)
2601 return -ENOMEM; 2601 return err;
2602 2602
2603 rme9652 = (struct snd_rme9652 *) card->private_data; 2603 rme9652 = (struct snd_rme9652 *) card->private_data;
2604 card->private_free = snd_rme9652_card_free; 2604 card->private_free = snd_rme9652_card_free;
diff --git a/sound/pci/sis7019.c b/sound/pci/sis7019.c
index df2007e3be7c..baf6d8e3dabc 100644
--- a/sound/pci/sis7019.c
+++ b/sound/pci/sis7019.c
@@ -1387,9 +1387,8 @@ static int __devinit snd_sis7019_probe(struct pci_dev *pci,
1387 if (!enable) 1387 if (!enable)
1388 goto error_out; 1388 goto error_out;
1389 1389
1390 rc = -ENOMEM; 1390 rc = snd_card_create(index, id, THIS_MODULE, sizeof(*sis), &card);
1391 card = snd_card_new(index, id, THIS_MODULE, sizeof(*sis)); 1391 if (rc < 0)
1392 if (!card)
1393 goto error_out; 1392 goto error_out;
1394 1393
1395 strcpy(card->driver, "SiS7019"); 1394 strcpy(card->driver, "SiS7019");
diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c
index cd408b86c839..c5601b0ad7cc 100644
--- a/sound/pci/sonicvibes.c
+++ b/sound/pci/sonicvibes.c
@@ -1423,9 +1423,9 @@ static int __devinit snd_sonic_probe(struct pci_dev *pci,
1423 return -ENOENT; 1423 return -ENOENT;
1424 } 1424 }
1425 1425
1426 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 1426 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
1427 if (card == NULL) 1427 if (err < 0)
1428 return -ENOMEM; 1428 return err;
1429 for (idx = 0; idx < 5; idx++) { 1429 for (idx = 0; idx < 5; idx++) {
1430 if (pci_resource_start(pci, idx) == 0 || 1430 if (pci_resource_start(pci, idx) == 0 ||
1431 !(pci_resource_flags(pci, idx) & IORESOURCE_IO)) { 1431 !(pci_resource_flags(pci, idx) & IORESOURCE_IO)) {
diff --git a/sound/pci/trident/trident.c b/sound/pci/trident/trident.c
index d94b16ffb385..21cef97d478d 100644
--- a/sound/pci/trident/trident.c
+++ b/sound/pci/trident/trident.c
@@ -89,9 +89,9 @@ static int __devinit snd_trident_probe(struct pci_dev *pci,
89 return -ENOENT; 89 return -ENOENT;
90 } 90 }
91 91
92 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 92 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
93 if (card == NULL) 93 if (err < 0)
94 return -ENOMEM; 94 return err;
95 95
96 if ((err = snd_trident_create(card, pci, 96 if ((err = snd_trident_create(card, pci,
97 pcm_channels[dev], 97 pcm_channels[dev],
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c
index 1aafe956ee2b..d8705547dae1 100644
--- a/sound/pci/via82xx.c
+++ b/sound/pci/via82xx.c
@@ -2433,9 +2433,9 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci,
2433 unsigned int i; 2433 unsigned int i;
2434 int err; 2434 int err;
2435 2435
2436 card = snd_card_new(index, id, THIS_MODULE, 0); 2436 err = snd_card_create(index, id, THIS_MODULE, 0, &card);
2437 if (card == NULL) 2437 if (err < 0)
2438 return -ENOMEM; 2438 return err;
2439 2439
2440 card_type = pci_id->driver_data; 2440 card_type = pci_id->driver_data;
2441 switch (card_type) { 2441 switch (card_type) {
diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c
index 5bd79d2a5a15..c086b762c150 100644
--- a/sound/pci/via82xx_modem.c
+++ b/sound/pci/via82xx_modem.c
@@ -1167,9 +1167,9 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci,
1167 unsigned int i; 1167 unsigned int i;
1168 int err; 1168 int err;
1169 1169
1170 card = snd_card_new(index, id, THIS_MODULE, 0); 1170 err = snd_card_create(index, id, THIS_MODULE, 0, &card);
1171 if (card == NULL) 1171 if (err < 0)
1172 return -ENOMEM; 1172 return err;
1173 1173
1174 card_type = pci_id->driver_data; 1174 card_type = pci_id->driver_data;
1175 switch (card_type) { 1175 switch (card_type) {
diff --git a/sound/pci/vx222/vx222.c b/sound/pci/vx222/vx222.c
index acc352f4a441..fc9136c3e0d7 100644
--- a/sound/pci/vx222/vx222.c
+++ b/sound/pci/vx222/vx222.c
@@ -204,9 +204,9 @@ static int __devinit snd_vx222_probe(struct pci_dev *pci,
204 return -ENOENT; 204 return -ENOENT;
205 } 205 }
206 206
207 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 207 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
208 if (card == NULL) 208 if (err < 0)
209 return -ENOMEM; 209 return err;
210 210
211 switch ((int)pci_id->driver_data) { 211 switch ((int)pci_id->driver_data) {
212 case VX_PCI_VX222_OLD: 212 case VX_PCI_VX222_OLD:
diff --git a/sound/pci/ymfpci/ymfpci.c b/sound/pci/ymfpci/ymfpci.c
index 2631a554845e..4af66661f9b0 100644
--- a/sound/pci/ymfpci/ymfpci.c
+++ b/sound/pci/ymfpci/ymfpci.c
@@ -187,9 +187,9 @@ static int __devinit snd_card_ymfpci_probe(struct pci_dev *pci,
187 return -ENOENT; 187 return -ENOENT;
188 } 188 }
189 189
190 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 190 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
191 if (card == NULL) 191 if (err < 0)
192 return -ENOMEM; 192 return err;
193 193
194 switch (pci_id->device) { 194 switch (pci_id->device) {
195 case 0x0004: str = "YMF724"; model = "DS-1"; break; 195 case 0x0004: str = "YMF724"; model = "DS-1"; break;
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 */
92static int snd_pdacf_probe(struct pcmcia_device *link) 92static 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 */
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
diff --git a/sound/ppc/powermac.c b/sound/ppc/powermac.c
index c936225771ba..2e18ed0ea899 100644
--- a/sound/ppc/powermac.c
+++ b/sound/ppc/powermac.c
@@ -58,9 +58,9 @@ static int __init snd_pmac_probe(struct platform_device *devptr)
58 char *name_ext; 58 char *name_ext;
59 int err; 59 int err;
60 60
61 card = snd_card_new(index, id, THIS_MODULE, 0); 61 err = snd_card_create(index, id, THIS_MODULE, 0, &card);
62 if (card == NULL) 62 if (err < 0)
63 return -ENOMEM; 63 return err;
64 64
65 if ((err = snd_pmac_new(card, &chip)) < 0) 65 if ((err = snd_pmac_new(card, &chip)) < 0)
66 goto __error; 66 goto __error;
diff --git a/sound/ppc/snd_ps3.c b/sound/ppc/snd_ps3.c
index ff321110ec02..f361c26506aa 100644
--- a/sound/ppc/snd_ps3.c
+++ b/sound/ppc/snd_ps3.c
@@ -969,11 +969,9 @@ static int __init snd_ps3_driver_probe(struct ps3_system_bus_device *dev)
969 } 969 }
970 970
971 /* create card instance */ 971 /* create card instance */
972 the_card.card = snd_card_new(index, id, THIS_MODULE, 0); 972 ret = snd_card_create(index, id, THIS_MODULE, 0, &the_card.card);
973 if (!the_card.card) { 973 if (ret < 0)
974 ret = -ENXIO;
975 goto clean_irq; 974 goto clean_irq;
976 }
977 975
978 strcpy(the_card.card->driver, "PS3"); 976 strcpy(the_card.card->driver, "PS3");
979 strcpy(the_card.card->shortname, "PS3"); 977 strcpy(the_card.card->shortname, "PS3");
diff --git a/sound/sh/aica.c b/sound/sh/aica.c
index 7c920f3e7fe3..f551233c5a08 100644
--- a/sound/sh/aica.c
+++ b/sound/sh/aica.c
@@ -609,11 +609,11 @@ static int __devinit snd_aica_probe(struct platform_device *devptr)
609 dreamcastcard = kmalloc(sizeof(struct snd_card_aica), GFP_KERNEL); 609 dreamcastcard = kmalloc(sizeof(struct snd_card_aica), GFP_KERNEL);
610 if (unlikely(!dreamcastcard)) 610 if (unlikely(!dreamcastcard))
611 return -ENOMEM; 611 return -ENOMEM;
612 dreamcastcard->card = 612 err = snd_card_create(index, SND_AICA_DRIVER, THIS_MODULE, 0,
613 snd_card_new(index, SND_AICA_DRIVER, THIS_MODULE, 0); 613 &dreamcastcard->card);
614 if (unlikely(!dreamcastcard->card)) { 614 if (unlikely(err < 0)) {
615 kfree(dreamcastcard); 615 kfree(dreamcastcard);
616 return -ENODEV; 616 return err;
617 } 617 }
618 strcpy(dreamcastcard->card->driver, "snd_aica"); 618 strcpy(dreamcastcard->card->driver, "snd_aica");
619 strcpy(dreamcastcard->card->shortname, SND_AICA_DRIVER); 619 strcpy(dreamcastcard->card->shortname, SND_AICA_DRIVER);
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index ec3f8bb4b51d..637f0d1ea98e 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1311,17 +1311,17 @@ int snd_soc_new_pcms(struct snd_soc_device *socdev, int idx, const char *xid)
1311{ 1311{
1312 struct snd_soc_codec *codec = socdev->codec; 1312 struct snd_soc_codec *codec = socdev->codec;
1313 struct snd_soc_card *card = socdev->card; 1313 struct snd_soc_card *card = socdev->card;
1314 int ret = 0, i; 1314 int ret, i;
1315 1315
1316 mutex_lock(&codec->mutex); 1316 mutex_lock(&codec->mutex);
1317 1317
1318 /* register a sound card */ 1318 /* register a sound card */
1319 codec->card = snd_card_new(idx, xid, codec->owner, 0); 1319 ret = snd_card_create(idx, xid, codec->owner, 0, &codec->card);
1320 if (!codec->card) { 1320 if (ret < 0) {
1321 printk(KERN_ERR "asoc: can't create sound card for codec %s\n", 1321 printk(KERN_ERR "asoc: can't create sound card for codec %s\n",
1322 codec->name); 1322 codec->name);
1323 mutex_unlock(&codec->mutex); 1323 mutex_unlock(&codec->mutex);
1324 return -ENODEV; 1324 return ret;
1325 } 1325 }
1326 1326
1327 codec->card->dev = socdev->dev; 1327 codec->card->dev = socdev->dev;
diff --git a/sound/sparc/amd7930.c b/sound/sparc/amd7930.c
index f87933e48812..ba38912614b4 100644
--- a/sound/sparc/amd7930.c
+++ b/sound/sparc/amd7930.c
@@ -1018,9 +1018,10 @@ static int __devinit amd7930_sbus_probe(struct of_device *op, const struct of_de
1018 return -ENOENT; 1018 return -ENOENT;
1019 } 1019 }
1020 1020
1021 card = snd_card_new(index[dev_num], id[dev_num], THIS_MODULE, 0); 1021 err = snd_card_create(index[dev_num], id[dev_num], THIS_MODULE, 0,
1022 if (card == NULL) 1022 &card);
1023 return -ENOMEM; 1023 if (err < 0)
1024 return err;
1024 1025
1025 strcpy(card->driver, "AMD7930"); 1026 strcpy(card->driver, "AMD7930");
1026 strcpy(card->shortname, "Sun AMD7930"); 1027 strcpy(card->shortname, "Sun AMD7930");
diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c
index 41c387587474..7d93fa705ccf 100644
--- a/sound/sparc/cs4231.c
+++ b/sound/sparc/cs4231.c
@@ -1563,6 +1563,7 @@ static int __init cs4231_attach_begin(struct snd_card **rcard)
1563{ 1563{
1564 struct snd_card *card; 1564 struct snd_card *card;
1565 struct snd_cs4231 *chip; 1565 struct snd_cs4231 *chip;
1566 int err;
1566 1567
1567 *rcard = NULL; 1568 *rcard = NULL;
1568 1569
@@ -1574,10 +1575,10 @@ static int __init cs4231_attach_begin(struct snd_card **rcard)
1574 return -ENOENT; 1575 return -ENOENT;
1575 } 1576 }
1576 1577
1577 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 1578 err = snd_card_create(index[dev], id[dev], THIS_MODULE,
1578 sizeof(struct snd_cs4231)); 1579 sizeof(struct snd_cs4231), &card);
1579 if (card == NULL) 1580 if (err < 0)
1580 return -ENOMEM; 1581 return err;
1581 1582
1582 strcpy(card->driver, "CS4231"); 1583 strcpy(card->driver, "CS4231");
1583 strcpy(card->shortname, "Sun CS4231"); 1584 strcpy(card->shortname, "Sun CS4231");
diff --git a/sound/sparc/dbri.c b/sound/sparc/dbri.c
index 23ed6f04a718..af95ff1e126c 100644
--- a/sound/sparc/dbri.c
+++ b/sound/sparc/dbri.c
@@ -2612,10 +2612,10 @@ static int __devinit dbri_probe(struct of_device *op, const struct of_device_id
2612 return -ENODEV; 2612 return -ENODEV;
2613 } 2613 }
2614 2614
2615 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 2615 err = snd_card_create(index[dev], id[dev], THIS_MODULE,
2616 sizeof(struct snd_dbri)); 2616 sizeof(struct snd_dbri), &card);
2617 if (card == NULL) 2617 if (err < 0)
2618 return -ENOMEM; 2618 return err;
2619 2619
2620 strcpy(card->driver, "DBRI"); 2620 strcpy(card->driver, "DBRI");
2621 strcpy(card->shortname, "Sun DBRI"); 2621 strcpy(card->shortname, "Sun DBRI");
diff --git a/sound/spi/at73c213.c b/sound/spi/at73c213.c
index 09802e8a6fb8..4c7b051f9d17 100644
--- a/sound/spi/at73c213.c
+++ b/sound/spi/at73c213.c
@@ -965,12 +965,11 @@ static int __devinit snd_at73c213_probe(struct spi_device *spi)
965 return PTR_ERR(board->dac_clk); 965 return PTR_ERR(board->dac_clk);
966 } 966 }
967 967
968 retval = -ENOMEM;
969
970 /* Allocate "card" using some unused identifiers. */ 968 /* Allocate "card" using some unused identifiers. */
971 snprintf(id, sizeof id, "at73c213_%d", board->ssc_id); 969 snprintf(id, sizeof id, "at73c213_%d", board->ssc_id);
972 card = snd_card_new(-1, id, THIS_MODULE, sizeof(struct snd_at73c213)); 970 retval = snd_card_create(-1, id, THIS_MODULE,
973 if (!card) 971 sizeof(struct snd_at73c213), &card);
972 if (retval < 0)
974 goto out; 973 goto out;
975 974
976 chip = card->private_data; 975 chip = card->private_data;
diff --git a/sound/synth/emux/emux_hwdep.c b/sound/synth/emux/emux_hwdep.c
index 0a5391436add..ff0b2a8fd25b 100644
--- a/sound/synth/emux/emux_hwdep.c
+++ b/sound/synth/emux/emux_hwdep.c
@@ -24,25 +24,6 @@
24#include <asm/uaccess.h> 24#include <asm/uaccess.h>
25#include "emux_voice.h" 25#include "emux_voice.h"
26 26
27/*
28 * open the hwdep device
29 */
30static int
31snd_emux_hwdep_open(struct snd_hwdep *hw, struct file *file)
32{
33 return 0;
34}
35
36
37/*
38 * close the device
39 */
40static int
41snd_emux_hwdep_release(struct snd_hwdep *hw, struct file *file)
42{
43 return 0;
44}
45
46 27
47#define TMP_CLIENT_ID 0x1001 28#define TMP_CLIENT_ID 0x1001
48 29
@@ -146,8 +127,6 @@ snd_emux_init_hwdep(struct snd_emux *emu)
146 emu->hwdep = hw; 127 emu->hwdep = hw;
147 strcpy(hw->name, SNDRV_EMUX_HWDEP_NAME); 128 strcpy(hw->name, SNDRV_EMUX_HWDEP_NAME);
148 hw->iface = SNDRV_HWDEP_IFACE_EMUX_WAVETABLE; 129 hw->iface = SNDRV_HWDEP_IFACE_EMUX_WAVETABLE;
149 hw->ops.open = snd_emux_hwdep_open;
150 hw->ops.release = snd_emux_hwdep_release;
151 hw->ops.ioctl = snd_emux_hwdep_ioctl; 130 hw->ops.ioctl = snd_emux_hwdep_ioctl;
152 hw->exclusive = 1; 131 hw->exclusive = 1;
153 hw->private_data = emu; 132 hw->private_data = emu;
diff --git a/sound/usb/caiaq/caiaq-device.c b/sound/usb/caiaq/caiaq-device.c
index 41c36b055f6b..09aed2363cc9 100644
--- a/sound/usb/caiaq/caiaq-device.c
+++ b/sound/usb/caiaq/caiaq-device.c
@@ -336,9 +336,10 @@ static void __devinit setup_card(struct snd_usb_caiaqdev *dev)
336 log("Unable to set up control system (ret=%d)\n", ret); 336 log("Unable to set up control system (ret=%d)\n", ret);
337} 337}
338 338
339static struct snd_card* create_card(struct usb_device* usb_dev) 339static int create_card(struct usb_device* usb_dev, struct snd_card **cardp)
340{ 340{
341 int devnum; 341 int devnum;
342 int err;
342 struct snd_card *card; 343 struct snd_card *card;
343 struct snd_usb_caiaqdev *dev; 344 struct snd_usb_caiaqdev *dev;
344 345
@@ -347,12 +348,12 @@ static struct snd_card* create_card(struct usb_device* usb_dev)
347 break; 348 break;
348 349
349 if (devnum >= SNDRV_CARDS) 350 if (devnum >= SNDRV_CARDS)
350 return NULL; 351 return -ENODEV;
351 352
352 card = snd_card_new(index[devnum], id[devnum], THIS_MODULE, 353 err = snd_card_create(index[devnum], id[devnum], THIS_MODULE,
353 sizeof(struct snd_usb_caiaqdev)); 354 sizeof(struct snd_usb_caiaqdev), &card);
354 if (!card) 355 if (err < 0)
355 return NULL; 356 return err;
356 357
357 dev = caiaqdev(card); 358 dev = caiaqdev(card);
358 dev->chip.dev = usb_dev; 359 dev->chip.dev = usb_dev;
@@ -362,7 +363,8 @@ static struct snd_card* create_card(struct usb_device* usb_dev)
362 spin_lock_init(&dev->spinlock); 363 spin_lock_init(&dev->spinlock);
363 snd_card_set_dev(card, &usb_dev->dev); 364 snd_card_set_dev(card, &usb_dev->dev);
364 365
365 return card; 366 *cardp = card;
367 return 0;
366} 368}
367 369
368static int __devinit init_card(struct snd_usb_caiaqdev *dev) 370static int __devinit init_card(struct snd_usb_caiaqdev *dev)
@@ -441,10 +443,10 @@ static int __devinit snd_probe(struct usb_interface *intf,
441 struct snd_card *card; 443 struct snd_card *card;
442 struct usb_device *device = interface_to_usbdev(intf); 444 struct usb_device *device = interface_to_usbdev(intf);
443 445
444 card = create_card(device); 446 ret = create_card(device, &card);
445 447
446 if (!card) 448 if (ret < 0)
447 return -ENOMEM; 449 return ret;
448 450
449 usb_set_intfdata(intf, card); 451 usb_set_intfdata(intf, card);
450 ret = init_card(caiaqdev(card)); 452 ret = init_card(caiaqdev(card));
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
index 19e37451c216..8f3cdb37a0ec 100644
--- a/sound/usb/usbaudio.c
+++ b/sound/usb/usbaudio.c
@@ -3466,10 +3466,10 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx,
3466 return -ENXIO; 3466 return -ENXIO;
3467 } 3467 }
3468 3468
3469 card = snd_card_new(index[idx], id[idx], THIS_MODULE, 0); 3469 err = snd_card_create(index[idx], id[idx], THIS_MODULE, 0, &card);
3470 if (card == NULL) { 3470 if (err < 0) {
3471 snd_printk(KERN_ERR "cannot create card instance %d\n", idx); 3471 snd_printk(KERN_ERR "cannot create card instance %d\n", idx);
3472 return -ENOMEM; 3472 return err;
3473 } 3473 }
3474 3474
3475 chip = kzalloc(sizeof(*chip), GFP_KERNEL); 3475 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
diff --git a/sound/usb/usbmixer.c b/sound/usb/usbmixer.c
index 00397c8a765b..2bde79216fa5 100644
--- a/sound/usb/usbmixer.c
+++ b/sound/usb/usbmixer.c
@@ -78,7 +78,6 @@ struct usb_mixer_interface {
78 78
79 /* Sound Blaster remote control stuff */ 79 /* Sound Blaster remote control stuff */
80 const struct rc_config *rc_cfg; 80 const struct rc_config *rc_cfg;
81 unsigned long rc_hwdep_open;
82 u32 rc_code; 81 u32 rc_code;
83 wait_queue_head_t rc_waitq; 82 wait_queue_head_t rc_waitq;
84 struct urb *rc_urb; 83 struct urb *rc_urb;
@@ -1797,24 +1796,6 @@ static void snd_usb_soundblaster_remote_complete(struct urb *urb)
1797 wake_up(&mixer->rc_waitq); 1796 wake_up(&mixer->rc_waitq);
1798} 1797}
1799 1798
1800static int snd_usb_sbrc_hwdep_open(struct snd_hwdep *hw, struct file *file)
1801{
1802 struct usb_mixer_interface *mixer = hw->private_data;
1803
1804 if (test_and_set_bit(0, &mixer->rc_hwdep_open))
1805 return -EBUSY;
1806 return 0;
1807}
1808
1809static int snd_usb_sbrc_hwdep_release(struct snd_hwdep *hw, struct file *file)
1810{
1811 struct usb_mixer_interface *mixer = hw->private_data;
1812
1813 clear_bit(0, &mixer->rc_hwdep_open);
1814 smp_mb__after_clear_bit();
1815 return 0;
1816}
1817
1818static long snd_usb_sbrc_hwdep_read(struct snd_hwdep *hw, char __user *buf, 1799static long snd_usb_sbrc_hwdep_read(struct snd_hwdep *hw, char __user *buf,
1819 long count, loff_t *offset) 1800 long count, loff_t *offset)
1820{ 1801{
@@ -1867,9 +1848,8 @@ static int snd_usb_soundblaster_remote_init(struct usb_mixer_interface *mixer)
1867 hwdep->iface = SNDRV_HWDEP_IFACE_SB_RC; 1848 hwdep->iface = SNDRV_HWDEP_IFACE_SB_RC;
1868 hwdep->private_data = mixer; 1849 hwdep->private_data = mixer;
1869 hwdep->ops.read = snd_usb_sbrc_hwdep_read; 1850 hwdep->ops.read = snd_usb_sbrc_hwdep_read;
1870 hwdep->ops.open = snd_usb_sbrc_hwdep_open;
1871 hwdep->ops.release = snd_usb_sbrc_hwdep_release;
1872 hwdep->ops.poll = snd_usb_sbrc_hwdep_poll; 1851 hwdep->ops.poll = snd_usb_sbrc_hwdep_poll;
1852 hwdep->exclusive = 1;
1873 1853
1874 mixer->rc_urb = usb_alloc_urb(0, GFP_KERNEL); 1854 mixer->rc_urb = usb_alloc_urb(0, GFP_KERNEL);
1875 if (!mixer->rc_urb) 1855 if (!mixer->rc_urb)
diff --git a/sound/usb/usx2y/us122l.c b/sound/usb/usx2y/us122l.c
index 73e59f4403a4..98276aafefe6 100644
--- a/sound/usb/usx2y/us122l.c
+++ b/sound/usb/usx2y/us122l.c
@@ -478,19 +478,21 @@ static bool us122l_create_card(struct snd_card *card)
478 return true; 478 return true;
479} 479}
480 480
481static struct snd_card *usx2y_create_card(struct usb_device *device) 481static int usx2y_create_card(struct usb_device *device, struct snd_card **cardp)
482{ 482{
483 int dev; 483 int dev;
484 struct snd_card *card; 484 struct snd_card *card;
485 int err;
486
485 for (dev = 0; dev < SNDRV_CARDS; ++dev) 487 for (dev = 0; dev < SNDRV_CARDS; ++dev)
486 if (enable[dev] && !snd_us122l_card_used[dev]) 488 if (enable[dev] && !snd_us122l_card_used[dev])
487 break; 489 break;
488 if (dev >= SNDRV_CARDS) 490 if (dev >= SNDRV_CARDS)
489 return NULL; 491 return -ENODEV;
490 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 492 err = snd_card_create(index[dev], id[dev], THIS_MODULE,
491 sizeof(struct us122l)); 493 sizeof(struct us122l), &card);
492 if (!card) 494 if (err < 0)
493 return NULL; 495 return err;
494 snd_us122l_card_used[US122L(card)->chip.index = dev] = 1; 496 snd_us122l_card_used[US122L(card)->chip.index = dev] = 1;
495 497
496 US122L(card)->chip.dev = device; 498 US122L(card)->chip.dev = device;
@@ -509,46 +511,57 @@ static struct snd_card *usx2y_create_card(struct usb_device *device)
509 US122L(card)->chip.dev->devnum 511 US122L(card)->chip.dev->devnum
510 ); 512 );
511 snd_card_set_dev(card, &device->dev); 513 snd_card_set_dev(card, &device->dev);
512 return card; 514 *cardp = card;
515 return 0;
513} 516}
514 517
515static void *us122l_usb_probe(struct usb_interface *intf, 518static int us122l_usb_probe(struct usb_interface *intf,
516 const struct usb_device_id *device_id) 519 const struct usb_device_id *device_id,
520 struct snd_card **cardp)
517{ 521{
518 struct usb_device *device = interface_to_usbdev(intf); 522 struct usb_device *device = interface_to_usbdev(intf);
519 struct snd_card *card = usx2y_create_card(device); 523 struct snd_card *card;
524 int err;
520 525
521 if (!card) 526 err = usx2y_create_card(device, &card);
522 return NULL; 527 if (err < 0)
528 return err;
523 529
524 if (!us122l_create_card(card) || 530 if (!us122l_create_card(card)) {
525 snd_card_register(card) < 0) {
526 snd_card_free(card); 531 snd_card_free(card);
527 return NULL; 532 return -EINVAL;
533 }
534
535 err = snd_card_register(card);
536 if (err < 0) {
537 snd_card_free(card);
538 return err;
528 } 539 }
529 540
530 usb_get_dev(device); 541 usb_get_dev(device);
531 return card; 542 *cardp = card;
543 return 0;
532} 544}
533 545
534static int snd_us122l_probe(struct usb_interface *intf, 546static int snd_us122l_probe(struct usb_interface *intf,
535 const struct usb_device_id *id) 547 const struct usb_device_id *id)
536{ 548{
537 struct snd_card *card; 549 struct snd_card *card;
550 int err;
551
538 snd_printdd(KERN_DEBUG"%p:%i\n", 552 snd_printdd(KERN_DEBUG"%p:%i\n",
539 intf, intf->cur_altsetting->desc.bInterfaceNumber); 553 intf, intf->cur_altsetting->desc.bInterfaceNumber);
540 if (intf->cur_altsetting->desc.bInterfaceNumber != 1) 554 if (intf->cur_altsetting->desc.bInterfaceNumber != 1)
541 return 0; 555 return 0;
542 556
543 card = us122l_usb_probe(usb_get_intf(intf), id); 557 err = us122l_usb_probe(usb_get_intf(intf), id, &card);
544 558 if (err < 0) {
545 if (card) { 559 usb_put_intf(intf);
546 usb_set_intfdata(intf, card); 560 return err;
547 return 0;
548 } 561 }
549 562
550 usb_put_intf(intf); 563 usb_set_intfdata(intf, card);
551 return -EIO; 564 return 0;
552} 565}
553 566
554static void snd_us122l_disconnect(struct usb_interface *intf) 567static void snd_us122l_disconnect(struct usb_interface *intf)
diff --git a/sound/usb/usx2y/usX2Yhwdep.c b/sound/usb/usx2y/usX2Yhwdep.c
index 1558a5c4094f..a26d8d83d3eb 100644
--- a/sound/usb/usx2y/usX2Yhwdep.c
+++ b/sound/usb/usx2y/usX2Yhwdep.c
@@ -106,16 +106,6 @@ static unsigned int snd_us428ctls_poll(struct snd_hwdep *hw, struct file *file,
106} 106}
107 107
108 108
109static int snd_usX2Y_hwdep_open(struct snd_hwdep *hw, struct file *file)
110{
111 return 0;
112}
113
114static int snd_usX2Y_hwdep_release(struct snd_hwdep *hw, struct file *file)
115{
116 return 0;
117}
118
119static int snd_usX2Y_hwdep_dsp_status(struct snd_hwdep *hw, 109static int snd_usX2Y_hwdep_dsp_status(struct snd_hwdep *hw,
120 struct snd_hwdep_dsp_status *info) 110 struct snd_hwdep_dsp_status *info)
121{ 111{
@@ -267,8 +257,6 @@ int usX2Y_hwdep_new(struct snd_card *card, struct usb_device* device)
267 257
268 hw->iface = SNDRV_HWDEP_IFACE_USX2Y; 258 hw->iface = SNDRV_HWDEP_IFACE_USX2Y;
269 hw->private_data = usX2Y(card); 259 hw->private_data = usX2Y(card);
270 hw->ops.open = snd_usX2Y_hwdep_open;
271 hw->ops.release = snd_usX2Y_hwdep_release;
272 hw->ops.dsp_status = snd_usX2Y_hwdep_dsp_status; 260 hw->ops.dsp_status = snd_usX2Y_hwdep_dsp_status;
273 hw->ops.dsp_load = snd_usX2Y_hwdep_dsp_load; 261 hw->ops.dsp_load = snd_usX2Y_hwdep_dsp_load;
274 hw->ops.mmap = snd_us428ctls_mmap; 262 hw->ops.mmap = snd_us428ctls_mmap;
diff --git a/sound/usb/usx2y/usbusx2y.c b/sound/usb/usx2y/usbusx2y.c
index 11639bd72a51..af8b84954054 100644
--- a/sound/usb/usx2y/usbusx2y.c
+++ b/sound/usb/usx2y/usbusx2y.c
@@ -333,18 +333,21 @@ static struct usb_device_id snd_usX2Y_usb_id_table[] = {
333 { /* terminator */ } 333 { /* terminator */ }
334}; 334};
335 335
336static struct snd_card *usX2Y_create_card(struct usb_device *device) 336static int usX2Y_create_card(struct usb_device *device, struct snd_card **cardp)
337{ 337{
338 int dev; 338 int dev;
339 struct snd_card * card; 339 struct snd_card * card;
340 int err;
341
340 for (dev = 0; dev < SNDRV_CARDS; ++dev) 342 for (dev = 0; dev < SNDRV_CARDS; ++dev)
341 if (enable[dev] && !snd_usX2Y_card_used[dev]) 343 if (enable[dev] && !snd_usX2Y_card_used[dev])
342 break; 344 break;
343 if (dev >= SNDRV_CARDS) 345 if (dev >= SNDRV_CARDS)
344 return NULL; 346 return -ENODEV;
345 card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(struct usX2Ydev)); 347 err = snd_card_create(index[dev], id[dev], THIS_MODULE,
346 if (!card) 348 sizeof(struct usX2Ydev), &card);
347 return NULL; 349 if (err < 0)
350 return err;
348 snd_usX2Y_card_used[usX2Y(card)->chip.index = dev] = 1; 351 snd_usX2Y_card_used[usX2Y(card)->chip.index = dev] = 1;
349 card->private_free = snd_usX2Y_card_private_free; 352 card->private_free = snd_usX2Y_card_private_free;
350 usX2Y(card)->chip.dev = device; 353 usX2Y(card)->chip.dev = device;
@@ -362,26 +365,36 @@ static struct snd_card *usX2Y_create_card(struct usb_device *device)
362 usX2Y(card)->chip.dev->bus->busnum, usX2Y(card)->chip.dev->devnum 365 usX2Y(card)->chip.dev->bus->busnum, usX2Y(card)->chip.dev->devnum
363 ); 366 );
364 snd_card_set_dev(card, &device->dev); 367 snd_card_set_dev(card, &device->dev);
365 return card; 368 *cardp = card;
369 return 0;
366} 370}
367 371
368 372
369static void *usX2Y_usb_probe(struct usb_device *device, struct usb_interface *intf, const struct usb_device_id *device_id) 373static int usX2Y_usb_probe(struct usb_device *device,
374 struct usb_interface *intf,
375 const struct usb_device_id *device_id,
376 struct snd_card **cardp)
370{ 377{
371 int err; 378 int err;
372 struct snd_card * card; 379 struct snd_card * card;
380
381 *cardp = NULL;
373 if (le16_to_cpu(device->descriptor.idVendor) != 0x1604 || 382 if (le16_to_cpu(device->descriptor.idVendor) != 0x1604 ||
374 (le16_to_cpu(device->descriptor.idProduct) != USB_ID_US122 && 383 (le16_to_cpu(device->descriptor.idProduct) != USB_ID_US122 &&
375 le16_to_cpu(device->descriptor.idProduct) != USB_ID_US224 && 384 le16_to_cpu(device->descriptor.idProduct) != USB_ID_US224 &&
376 le16_to_cpu(device->descriptor.idProduct) != USB_ID_US428) || 385 le16_to_cpu(device->descriptor.idProduct) != USB_ID_US428))
377 !(card = usX2Y_create_card(device))) 386 return -EINVAL;
378 return NULL; 387
388 err = usX2Y_create_card(device, &card);
389 if (err < 0)
390 return err;
379 if ((err = usX2Y_hwdep_new(card, device)) < 0 || 391 if ((err = usX2Y_hwdep_new(card, device)) < 0 ||
380 (err = snd_card_register(card)) < 0) { 392 (err = snd_card_register(card)) < 0) {
381 snd_card_free(card); 393 snd_card_free(card);
382 return NULL; 394 return err;
383 } 395 }
384 return card; 396 *cardp = card;
397 return 0;
385} 398}
386 399
387/* 400/*
@@ -389,13 +402,14 @@ static void *usX2Y_usb_probe(struct usb_device *device, struct usb_interface *in
389 */ 402 */
390static int snd_usX2Y_probe(struct usb_interface *intf, const struct usb_device_id *id) 403static int snd_usX2Y_probe(struct usb_interface *intf, const struct usb_device_id *id)
391{ 404{
392 void *chip; 405 struct snd_card *card;
393 chip = usX2Y_usb_probe(interface_to_usbdev(intf), intf, id); 406 int err;
394 if (chip) { 407
395 usb_set_intfdata(intf, chip); 408 err = usX2Y_usb_probe(interface_to_usbdev(intf), intf, id, &card);
396 return 0; 409 if (err < 0)
397 } else 410 return err;
398 return -EIO; 411 dev_set_drvdata(&intf->dev, card);
412 return 0;
399} 413}
400 414
401static void snd_usX2Y_disconnect(struct usb_interface *intf) 415static void snd_usX2Y_disconnect(struct usb_interface *intf)