aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-01-28 02:08:32 -0500
committerTakashi Iwai <tiwai@suse.de>2009-01-28 02:08:32 -0500
commit67fcdead3c7424d51e7108c220c9ab1a5e752ed3 (patch)
tree3c48fabced8e519ef3f83209a793dfea48dbbfa8
parent006f367e38fb45e2f161c0f500c74449ae63e866 (diff)
parentb1a0aac05f044e78a589bfd7a9e2334aa640eb45 (diff)
Merge branch 'topic/snd_card_new-err' into topic/asoc
Conflicts: sound/soc/soc-core.c
-rw-r--r--Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl44
-rw-r--r--drivers/media/video/cx88/cx88-alsa.c7
-rw-r--r--drivers/media/video/em28xx/em28xx-audio.c7
-rw-r--r--drivers/media/video/saa7134/saa7134-alsa.c8
-rw-r--r--drivers/staging/go7007/snd-go7007.c7
-rw-r--r--drivers/usb/gadget/gmidi.c7
-rw-r--r--include/sound/core.h14
-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/init.c47
-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/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.c31
-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.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.c6
-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/riptide/riptide.c6
-rw-r--r--sound/pci/rme32.c7
-rw-r--r--sound/pci/rme96.c7
-rw-r--r--sound/pci/rme9652/hdsp.c6
-rw-r--r--sound/pci/rme9652/hdspm.c8
-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/usb/caiaq/caiaq-device.c22
-rw-r--r--sound/usb/usbaudio.c6
-rw-r--r--sound/usb/usx2y/us122l.c59
-rw-r--r--sound/usb/usx2y/usbusx2y.c52
111 files changed, 617 insertions, 516 deletions
diff --git a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
index 87a7c07ab658..320384c1791b 100644
--- a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
+++ b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
@@ -492,9 +492,9 @@
492 } 492 }
493 493
494 /* (2) */ 494 /* (2) */
495 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 495 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
496 if (card == NULL) 496 if (err < 0)
497 return -ENOMEM; 497 return err;
498 498
499 /* (3) */ 499 /* (3) */
500 err = snd_mychip_create(card, pci, &chip); 500 err = snd_mychip_create(card, pci, &chip);
@@ -590,8 +590,9 @@
590 <programlisting> 590 <programlisting>
591<![CDATA[ 591<![CDATA[
592 struct snd_card *card; 592 struct snd_card *card;
593 int err;
593 .... 594 ....
594 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 595 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
595]]> 596]]>
596 </programlisting> 597 </programlisting>
597 </informalexample> 598 </informalexample>
@@ -809,26 +810,28 @@
809 810
810 <para> 811 <para>
811 As mentioned above, to create a card instance, call 812 As mentioned above, to create a card instance, call
812 <function>snd_card_new()</function>. 813 <function>snd_card_create()</function>.
813 814
814 <informalexample> 815 <informalexample>
815 <programlisting> 816 <programlisting>
816<![CDATA[ 817<![CDATA[
817 struct snd_card *card; 818 struct snd_card *card;
818 card = snd_card_new(index, id, module, extra_size); 819 int err;
820 err = snd_card_create(index, id, module, extra_size, &card);
819]]> 821]]>
820 </programlisting> 822 </programlisting>
821 </informalexample> 823 </informalexample>
822 </para> 824 </para>
823 825
824 <para> 826 <para>
825 The function takes four arguments, the card-index number, the 827 The function takes five arguments, the card-index number, the
826 id string, the module pointer (usually 828 id string, the module pointer (usually
827 <constant>THIS_MODULE</constant>), 829 <constant>THIS_MODULE</constant>),
828 and the size of extra-data space. The last argument is used to 830 the size of extra-data space, and the pointer to return the
831 card instance. The extra_size argument is used to
829 allocate card-&gt;private_data for the 832 allocate card-&gt;private_data for the
830 chip-specific data. Note that these data 833 chip-specific data. Note that these data
831 are allocated by <function>snd_card_new()</function>. 834 are allocated by <function>snd_card_create()</function>.
832 </para> 835 </para>
833 </section> 836 </section>
834 837
@@ -915,15 +918,16 @@
915 </para> 918 </para>
916 919
917 <section id="card-management-chip-specific-snd-card-new"> 920 <section id="card-management-chip-specific-snd-card-new">
918 <title>1. Allocating via <function>snd_card_new()</function>.</title> 921 <title>1. Allocating via <function>snd_card_create()</function>.</title>
919 <para> 922 <para>
920 As mentioned above, you can pass the extra-data-length 923 As mentioned above, you can pass the extra-data-length
921 to the 4th argument of <function>snd_card_new()</function>, i.e. 924 to the 4th argument of <function>snd_card_create()</function>, i.e.
922 925
923 <informalexample> 926 <informalexample>
924 <programlisting> 927 <programlisting>
925<![CDATA[ 928<![CDATA[
926 card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(struct mychip)); 929 err = snd_card_create(index[dev], id[dev], THIS_MODULE,
930 sizeof(struct mychip), &card);
927]]> 931]]>
928 </programlisting> 932 </programlisting>
929 </informalexample> 933 </informalexample>
@@ -952,8 +956,8 @@
952 956
953 <para> 957 <para>
954 After allocating a card instance via 958 After allocating a card instance via
955 <function>snd_card_new()</function> (with 959 <function>snd_card_create()</function> (with
956 <constant>NULL</constant> on the 4th arg), call 960 <constant>0</constant> on the 4th arg), call
957 <function>kzalloc()</function>. 961 <function>kzalloc()</function>.
958 962
959 <informalexample> 963 <informalexample>
@@ -961,7 +965,7 @@
961<![CDATA[ 965<![CDATA[
962 struct snd_card *card; 966 struct snd_card *card;
963 struct mychip *chip; 967 struct mychip *chip;
964 card = snd_card_new(index[dev], id[dev], THIS_MODULE, NULL); 968 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
965 ..... 969 .....
966 chip = kzalloc(sizeof(*chip), GFP_KERNEL); 970 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
967]]> 971]]>
@@ -5750,8 +5754,9 @@ struct _snd_pcm_runtime {
5750 .... 5754 ....
5751 struct snd_card *card; 5755 struct snd_card *card;
5752 struct mychip *chip; 5756 struct mychip *chip;
5757 int err;
5753 .... 5758 ....
5754 card = snd_card_new(index[dev], id[dev], THIS_MODULE, NULL); 5759 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
5755 .... 5760 ....
5756 chip = kzalloc(sizeof(*chip), GFP_KERNEL); 5761 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
5757 .... 5762 ....
@@ -5763,7 +5768,7 @@ struct _snd_pcm_runtime {
5763 </informalexample> 5768 </informalexample>
5764 5769
5765 When you created the chip data with 5770 When you created the chip data with
5766 <function>snd_card_new()</function>, it's anyway accessible 5771 <function>snd_card_create()</function>, it's anyway accessible
5767 via <structfield>private_data</structfield> field. 5772 via <structfield>private_data</structfield> field.
5768 5773
5769 <informalexample> 5774 <informalexample>
@@ -5775,9 +5780,10 @@ struct _snd_pcm_runtime {
5775 .... 5780 ....
5776 struct snd_card *card; 5781 struct snd_card *card;
5777 struct mychip *chip; 5782 struct mychip *chip;
5783 int err;
5778 .... 5784 ....
5779 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 5785 err = snd_card_create(index[dev], id[dev], THIS_MODULE,
5780 sizeof(struct mychip)); 5786 sizeof(struct mychip), &card);
5781 .... 5787 ....
5782 chip = card->private_data; 5788 chip = card->private_data;
5783 .... 5789 ....
diff --git a/drivers/media/video/cx88/cx88-alsa.c b/drivers/media/video/cx88/cx88-alsa.c
index 66c755c116dc..ce98d955231a 100644
--- a/drivers/media/video/cx88/cx88-alsa.c
+++ b/drivers/media/video/cx88/cx88-alsa.c
@@ -803,9 +803,10 @@ static int __devinit cx88_audio_initdev(struct pci_dev *pci,
803 return (-ENOENT); 803 return (-ENOENT);
804 } 804 }
805 805
806 card = snd_card_new(index[devno], id[devno], THIS_MODULE, sizeof(snd_cx88_card_t)); 806 err = snd_card_create(index[devno], id[devno], THIS_MODULE,
807 if (!card) 807 sizeof(snd_cx88_card_t), &card);
808 return (-ENOMEM); 808 if (err < 0)
809 return err;
809 810
810 card->private_free = snd_cx88_dev_free; 811 card->private_free = snd_cx88_dev_free;
811 812
diff --git a/drivers/media/video/em28xx/em28xx-audio.c b/drivers/media/video/em28xx/em28xx-audio.c
index 94378ccb7505..66579508e175 100644
--- a/drivers/media/video/em28xx/em28xx-audio.c
+++ b/drivers/media/video/em28xx/em28xx-audio.c
@@ -438,9 +438,10 @@ static int em28xx_audio_init(struct em28xx *dev)
438 printk(KERN_INFO "em28xx-audio.c: Copyright (C) 2006 Markus " 438 printk(KERN_INFO "em28xx-audio.c: Copyright (C) 2006 Markus "
439 "Rechberger\n"); 439 "Rechberger\n");
440 440
441 card = snd_card_new(index[devnr], "Em28xx Audio", THIS_MODULE, 0); 441 err = snd_card_create(index[devnr], "Em28xx Audio", THIS_MODULE, 0,
442 if (card == NULL) 442 &card);
443 return -ENOMEM; 443 if (err < 0)
444 return err;
444 445
445 spin_lock_init(&adev->slock); 446 spin_lock_init(&adev->slock);
446 err = snd_pcm_new(card, "Em28xx Audio", 0, 0, 1, &pcm); 447 err = snd_pcm_new(card, "Em28xx Audio", 0, 0, 1, &pcm);
diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c
index 26194a0ce927..482be1436e92 100644
--- a/drivers/media/video/saa7134/saa7134-alsa.c
+++ b/drivers/media/video/saa7134/saa7134-alsa.c
@@ -990,10 +990,10 @@ static int alsa_card_saa7134_create(struct saa7134_dev *dev, int devnum)
990 if (!enable[devnum]) 990 if (!enable[devnum])
991 return -ENODEV; 991 return -ENODEV;
992 992
993 card = snd_card_new(index[devnum], id[devnum], THIS_MODULE, sizeof(snd_card_saa7134_t)); 993 err = snd_card_create(index[devnum], id[devnum], THIS_MODULE,
994 994 sizeof(snd_card_saa7134_t), &card);
995 if (card == NULL) 995 if (err < 0)
996 return -ENOMEM; 996 return err;
997 997
998 strcpy(card->driver, "SAA7134"); 998 strcpy(card->driver, "SAA7134");
999 999
diff --git a/drivers/staging/go7007/snd-go7007.c b/drivers/staging/go7007/snd-go7007.c
index a7de401f61ab..cd19be6c00e0 100644
--- a/drivers/staging/go7007/snd-go7007.c
+++ b/drivers/staging/go7007/snd-go7007.c
@@ -248,10 +248,11 @@ int go7007_snd_init(struct go7007 *go)
248 spin_lock_init(&gosnd->lock); 248 spin_lock_init(&gosnd->lock);
249 gosnd->hw_ptr = gosnd->w_idx = gosnd->avail = 0; 249 gosnd->hw_ptr = gosnd->w_idx = gosnd->avail = 0;
250 gosnd->capturing = 0; 250 gosnd->capturing = 0;
251 gosnd->card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 251 ret = snd_card_create(index[dev], id[dev], THIS_MODULE, 0,
252 if (gosnd->card == NULL) { 252 &gosnd->card);
253 if (ret < 0) {
253 kfree(gosnd); 254 kfree(gosnd);
254 return -ENOMEM; 255 return ret;
255 } 256 }
256 ret = snd_device_new(gosnd->card, SNDRV_DEV_LOWLEVEL, go, 257 ret = snd_device_new(gosnd->card, SNDRV_DEV_LOWLEVEL, go,
257 &go7007_snd_device_ops); 258 &go7007_snd_device_ops);
diff --git a/drivers/usb/gadget/gmidi.c b/drivers/usb/gadget/gmidi.c
index 60d3f9e9b51f..14e09abbddfc 100644
--- a/drivers/usb/gadget/gmidi.c
+++ b/drivers/usb/gadget/gmidi.c
@@ -1099,10 +1099,9 @@ static int gmidi_register_card(struct gmidi_device *dev)
1099 .dev_free = gmidi_snd_free, 1099 .dev_free = gmidi_snd_free,
1100 }; 1100 };
1101 1101
1102 card = snd_card_new(index, id, THIS_MODULE, 0); 1102 err = snd_card_create(index, id, THIS_MODULE, 0, &card);
1103 if (!card) { 1103 if (err < 0) {
1104 ERROR(dev, "snd_card_new failed\n"); 1104 ERROR(dev, "snd_card_create failed\n");
1105 err = -ENOMEM;
1106 goto fail; 1105 goto fail;
1107 } 1106 }
1108 dev->card = card; 1107 dev->card = card;
diff --git a/include/sound/core.h b/include/sound/core.h
index f632484bc743..25420c3b5513 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -296,8 +296,20 @@ int snd_card_locked(int card);
296extern int (*snd_mixer_oss_notify_callback)(struct snd_card *card, int cmd); 296extern int (*snd_mixer_oss_notify_callback)(struct snd_card *card, int cmd);
297#endif 297#endif
298 298
299int snd_card_create(int idx, const char *id,
300 struct module *module, int extra_size,
301 struct snd_card **card_ret);
302
303static inline __deprecated
299struct snd_card *snd_card_new(int idx, const char *id, 304struct snd_card *snd_card_new(int idx, const char *id,
300 struct module *module, int extra_size); 305 struct module *module, int extra_size)
306{
307 struct snd_card *card;
308 if (snd_card_create(idx, id, module, extra_size, &card) < 0)
309 return NULL;
310 return card;
311}
312
301int snd_card_disconnect(struct snd_card *card); 313int snd_card_disconnect(struct snd_card *card);
302int snd_card_free(struct snd_card *card); 314int snd_card_free(struct snd_card *card);
303int snd_card_free_when_closed(struct snd_card *card); 315int snd_card_free_when_closed(struct snd_card *card);
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 89096e811a4b..7d39aac9ec14 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/init.c b/sound/core/init.c
index 0d5520c415d3..dc4b80c7f311 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;
@@ -202,26 +215,28 @@ struct snd_card *snd_card_new(int idx, const char *xid,
202#endif 215#endif
203 /* the control interface cannot be accessed from the user space until */ 216 /* the control interface cannot be accessed from the user space until */
204 /* snd_cards_bitmask and snd_cards are set with snd_card_register */ 217 /* snd_cards_bitmask and snd_cards are set with snd_card_register */
205 if ((err = snd_ctl_create(card)) < 0) { 218 err = snd_ctl_create(card);
206 snd_printd("unable to register control minors\n"); 219 if (err < 0) {
220 snd_printk(KERN_ERR "unable to register control minors\n");
207 goto __error; 221 goto __error;
208 } 222 }
209 if ((err = snd_info_card_create(card)) < 0) { 223 err = snd_info_card_create(card);
210 snd_printd("unable to create card info\n"); 224 if (err < 0) {
225 snd_printk(KERN_ERR "unable to create card info\n");
211 goto __error_ctl; 226 goto __error_ctl;
212 } 227 }
213 if (extra_size > 0) 228 if (extra_size > 0)
214 card->private_data = (char *)card + sizeof(struct snd_card); 229 card->private_data = (char *)card + sizeof(struct snd_card);
215 return card; 230 *card_ret = card;
231 return 0;
216 232
217 __error_ctl: 233 __error_ctl:
218 snd_device_free_all(card, SNDRV_DEV_CMD_PRE); 234 snd_device_free_all(card, SNDRV_DEV_CMD_PRE);
219 __error: 235 __error:
220 kfree(card); 236 kfree(card);
221 return NULL; 237 return err;
222} 238}
223 239EXPORT_SYMBOL(snd_card_create);
224EXPORT_SYMBOL(snd_card_new);
225 240
226/* return non-zero if a card is already locked */ 241/* return non-zero if a card is already locked */
227int snd_card_locked(int card) 242int snd_card_locked(int card)
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 5b89c0883d60..c3e9833dcfd9 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/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..645491a53023 100644
--- a/sound/isa/opl3sa2.c
+++ b/sound/isa/opl3sa2.c
@@ -617,21 +617,24 @@ static void snd_opl3sa2_free(struct snd_card *card)
617 release_and_free_resource(chip->res_port); 617 release_and_free_resource(chip->res_port);
618} 618}
619 619
620static struct snd_card *snd_opl3sa2_card_new(int dev) 620static int snd_opl3sa2_card_new(int dev, struct snd_card **cardp)
621{ 621{
622 struct snd_card *card; 622 struct snd_card *card;
623 struct snd_opl3sa2 *chip; 623 struct snd_opl3sa2 *chip;
624 int err;
624 625
625 card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(struct snd_opl3sa2)); 626 err = snd_card_create(index[dev], id[dev], THIS_MODULE,
626 if (card == NULL) 627 sizeof(struct snd_opl3sa2), &card);
627 return NULL; 628 if (err < 0)
629 return err;
628 strcpy(card->driver, "OPL3SA2"); 630 strcpy(card->driver, "OPL3SA2");
629 strcpy(card->shortname, "Yamaha OPL3-SA2"); 631 strcpy(card->shortname, "Yamaha OPL3-SA2");
630 chip = card->private_data; 632 chip = card->private_data;
631 spin_lock_init(&chip->reg_lock); 633 spin_lock_init(&chip->reg_lock);
632 chip->irq = -1; 634 chip->irq = -1;
633 card->private_free = snd_opl3sa2_free; 635 card->private_free = snd_opl3sa2_free;
634 return card; 636 *cardp = card;
637 return 0;
635} 638}
636 639
637static int __devinit snd_opl3sa2_probe(struct snd_card *card, int dev) 640static int __devinit snd_opl3sa2_probe(struct snd_card *card, int dev)
@@ -723,9 +726,9 @@ static int __devinit snd_opl3sa2_pnp_detect(struct pnp_dev *pdev,
723 if (dev >= SNDRV_CARDS) 726 if (dev >= SNDRV_CARDS)
724 return -ENODEV; 727 return -ENODEV;
725 728
726 card = snd_opl3sa2_card_new(dev); 729 err = snd_opl3sa2_card_new(dev, &card);
727 if (! card) 730 if (err < 0)
728 return -ENOMEM; 731 return err;
729 if ((err = snd_opl3sa2_pnp(dev, card->private_data, pdev)) < 0) { 732 if ((err = snd_opl3sa2_pnp(dev, card->private_data, pdev)) < 0) {
730 snd_card_free(card); 733 snd_card_free(card);
731 return err; 734 return err;
@@ -789,9 +792,9 @@ static int __devinit snd_opl3sa2_pnp_cdetect(struct pnp_card_link *pcard,
789 if (dev >= SNDRV_CARDS) 792 if (dev >= SNDRV_CARDS)
790 return -ENODEV; 793 return -ENODEV;
791 794
792 card = snd_opl3sa2_card_new(dev); 795 err = snd_opl3sa2_card_new(dev, &card);
793 if (! card) 796 if (err < 0)
794 return -ENOMEM; 797 return err;
795 if ((err = snd_opl3sa2_pnp(dev, card->private_data, pdev)) < 0) { 798 if ((err = snd_opl3sa2_pnp(dev, card->private_data, pdev)) < 0) {
796 snd_card_free(card); 799 snd_card_free(card);
797 return err; 800 return err;
@@ -870,9 +873,9 @@ static int __devinit snd_opl3sa2_isa_probe(struct device *pdev,
870 struct snd_card *card; 873 struct snd_card *card;
871 int err; 874 int err;
872 875
873 card = snd_opl3sa2_card_new(dev); 876 err = snd_opl3sa2_card_new(dev, &card);
874 if (! card) 877 if (err < 0)
875 return -ENOMEM; 878 return err;
876 snd_card_set_dev(card, pdev); 879 snd_card_set_dev(card, pdev);
877 if ((err = snd_opl3sa2_probe(card, dev)) < 0) { 880 if ((err = snd_opl3sa2_probe(card, dev)) < 0) {
878 snd_card_free(card); 881 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 3f00ddf450f8..eefcbf648ee1 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 11e791b965f6..f9603443f086 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -2335,10 +2335,10 @@ static int __devinit azx_probe(struct pci_dev *pci,
2335 return -ENOENT; 2335 return -ENOENT;
2336 } 2336 }
2337 2337
2338 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 2338 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
2339 if (!card) { 2339 if (err < 0) {
2340 snd_printk(KERN_ERR SFX "Error creating card!\n"); 2340 snd_printk(KERN_ERR SFX "Error creating card!\n");
2341 return -ENOMEM; 2341 return err;
2342 } 2342 }
2343 2343
2344 err = azx_create(card, pci, dev, pci_id->driver_data, &chip); 2344 err = azx_create(card, pci, dev, pci_id->driver_data, &chip);
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 19d3391e229f..671ff65db029 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..bfc19e36c4b6 100644
--- a/sound/pci/mixart/mixart.c
+++ b/sound/pci/mixart/mixart.c
@@ -1365,12 +1365,12 @@ static int __devinit snd_mixart_probe(struct pci_dev *pci,
1365 else 1365 else
1366 idx = index[dev] + i; 1366 idx = index[dev] + i;
1367 snprintf(tmpid, sizeof(tmpid), "%s-%d", id[dev] ? id[dev] : "MIXART", i); 1367 snprintf(tmpid, sizeof(tmpid), "%s-%d", id[dev] ? id[dev] : "MIXART", i);
1368 card = snd_card_new(idx, tmpid, THIS_MODULE, 0); 1368 err = snd_card_create(idx, tmpid, THIS_MODULE, 0, &card);
1369 1369
1370 if (! card) { 1370 if (err < 0) {
1371 snd_printk(KERN_ERR "cannot allocate the card %d\n", i); 1371 snd_printk(KERN_ERR "cannot allocate the card %d\n", i);
1372 snd_mixart_free(mgr); 1372 snd_mixart_free(mgr);
1373 return -ENOMEM; 1373 return err;
1374 } 1374 }
1375 1375
1376 strcpy(card->driver, CARD_NAME); 1376 strcpy(card->driver, CARD_NAME);
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/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..05b3f795a168 100644
--- a/sound/pci/rme9652/hdsp.c
+++ b/sound/pci/rme9652/hdsp.c
@@ -5158,8 +5158,10 @@ static int __devinit snd_hdsp_probe(struct pci_dev *pci,
5158 return -ENOENT; 5158 return -ENOENT;
5159 } 5159 }
5160 5160
5161 if (!(card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(struct hdsp)))) 5161 err = snd_card_create(index[dev], id[dev], THIS_MODULE,
5162 return -ENOMEM; 5162 sizeof(struct hdsp), &card);
5163 if (err < 0)
5164 return err;
5163 5165
5164 hdsp = (struct hdsp *) card->private_data; 5166 hdsp = (struct hdsp *) card->private_data;
5165 card->private_free = snd_hdsp_card_free; 5167 card->private_free = snd_hdsp_card_free;
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index 71231cf1b2b0..d4b4e0d0fee8 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -4503,10 +4503,10 @@ static int __devinit snd_hdspm_probe(struct pci_dev *pci,
4503 return -ENOENT; 4503 return -ENOENT;
4504 } 4504 }
4505 4505
4506 card = snd_card_new(index[dev], id[dev], 4506 err = snd_card_create(index[dev], id[dev],
4507 THIS_MODULE, sizeof(struct hdspm)); 4507 THIS_MODULE, sizeof(struct hdspm), &card);
4508 if (!card) 4508 if (err < 0)
4509 return -ENOMEM; 4509 return err;
4510 4510
4511 hdspm = card->private_data; 4511 hdspm = card->private_data;
4512 card->private_free = snd_hdspm_card_free; 4512 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 8f9e3859c37c..ef2c3f417175 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 f18c7a3e36d1..580a1a534ad0 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1308,17 +1308,17 @@ int snd_soc_new_pcms(struct snd_soc_device *socdev, int idx, const char *xid)
1308{ 1308{
1309 struct snd_soc_card *card = socdev->card; 1309 struct snd_soc_card *card = socdev->card;
1310 struct snd_soc_codec *codec = card->codec; 1310 struct snd_soc_codec *codec = card->codec;
1311 int ret = 0, i; 1311 int ret, i;
1312 1312
1313 mutex_lock(&codec->mutex); 1313 mutex_lock(&codec->mutex);
1314 1314
1315 /* register a sound card */ 1315 /* register a sound card */
1316 codec->card = snd_card_new(idx, xid, codec->owner, 0); 1316 ret = snd_card_create(idx, xid, codec->owner, 0, &codec->card);
1317 if (!codec->card) { 1317 if (ret < 0) {
1318 printk(KERN_ERR "asoc: can't create sound card for codec %s\n", 1318 printk(KERN_ERR "asoc: can't create sound card for codec %s\n",
1319 codec->name); 1319 codec->name);
1320 mutex_unlock(&codec->mutex); 1320 mutex_unlock(&codec->mutex);
1321 return -ENODEV; 1321 return ret;
1322 } 1322 }
1323 1323
1324 codec->card->dev = socdev->dev; 1324 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/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 c709b9563226..eec32e1a3020 100644
--- a/sound/usb/usbaudio.c
+++ b/sound/usb/usbaudio.c
@@ -3463,10 +3463,10 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx,
3463 return -ENXIO; 3463 return -ENXIO;
3464 } 3464 }
3465 3465
3466 card = snd_card_new(index[idx], id[idx], THIS_MODULE, 0); 3466 err = snd_card_create(index[idx], id[idx], THIS_MODULE, 0, &card);
3467 if (card == NULL) { 3467 if (err < 0) {
3468 snd_printk(KERN_ERR "cannot create card instance %d\n", idx); 3468 snd_printk(KERN_ERR "cannot create card instance %d\n", idx);
3469 return -ENOMEM; 3469 return err;
3470 } 3470 }
3471 3471
3472 chip = kzalloc(sizeof(*chip), GFP_KERNEL); 3472 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
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/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)