aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@alsa3.local>2008-12-28 10:47:30 -0500
committerTakashi Iwai <tiwai@suse.de>2009-01-12 09:21:54 -0500
commit3e7fb9f7ec00fd7cefd0d8e83df0cff86ce12515 (patch)
treedd04faa1ccf4d894bda0ca14eb667bc4be096623
parentd453379bc5d34d7f55b55931245de5ac1896fd8d (diff)
ALSA: Return proper error code at probe in sound/isa/*
Some drivers in sound/isa/* don't handle the error code properly from snd_card_create(). This patch fixes these places. Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/isa/cs423x/cs4236.c25
-rw-r--r--sound/isa/es18xx.c27
-rw-r--r--sound/isa/gus/interwave.c19
-rw-r--r--sound/isa/opti9xx/opti92x-ad1848.c20
-rw-r--r--sound/isa/sb/sb16.c19
-rw-r--r--sound/isa/wavefront/wavefront.c19
6 files changed, 65 insertions, 64 deletions
diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c
index db830682804f..f7845986f467 100644
--- a/sound/isa/cs423x/cs4236.c
+++ b/sound/isa/cs423x/cs4236.c
@@ -382,7 +382,7 @@ 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 int err;
@@ -390,9 +390,10 @@ static struct snd_card *snd_cs423x_card_new(int dev)
390 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 390 err = snd_card_create(index[dev], id[dev], THIS_MODULE,
391 sizeof(struct snd_card_cs4236), &card); 391 sizeof(struct snd_card_cs4236), &card);
392 if (err < 0) 392 if (err < 0)
393 return NULL; 393 return err;
394 card->private_free = snd_card_cs4236_free; 394 card->private_free = snd_card_cs4236_free;
395 return card; 395 *cardp = card;
396 return 0;
396} 397}
397 398
398static int __devinit snd_cs423x_probe(struct snd_card *card, int dev) 399static int __devinit snd_cs423x_probe(struct snd_card *card, int dev)
@@ -513,9 +514,9 @@ static int __devinit snd_cs423x_isa_probe(struct device *pdev,
513 struct snd_card *card; 514 struct snd_card *card;
514 int err; 515 int err;
515 516
516 card = snd_cs423x_card_new(dev); 517 err = snd_cs423x_card_new(dev, &card);
517 if (! card) 518 if (err < 0)
518 return -ENOMEM; 519 return err;
519 snd_card_set_dev(card, pdev); 520 snd_card_set_dev(card, pdev);
520 if ((err = snd_cs423x_probe(card, dev)) < 0) { 521 if ((err = snd_cs423x_probe(card, dev)) < 0) {
521 snd_card_free(card); 522 snd_card_free(card);
@@ -595,9 +596,9 @@ static int __devinit snd_cs4232_pnpbios_detect(struct pnp_dev *pdev,
595 if (dev >= SNDRV_CARDS) 596 if (dev >= SNDRV_CARDS)
596 return -ENODEV; 597 return -ENODEV;
597 598
598 card = snd_cs423x_card_new(dev); 599 err = snd_cs423x_card_new(dev, &card);
599 if (! card) 600 if (err < 0)
600 return -ENOMEM; 601 return err;
601 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) {
602 printk(KERN_ERR "PnP BIOS detection failed for " IDENT "\n"); 603 printk(KERN_ERR "PnP BIOS detection failed for " IDENT "\n");
603 snd_card_free(card); 604 snd_card_free(card);
@@ -657,9 +658,9 @@ static int __devinit snd_cs423x_pnpc_detect(struct pnp_card_link *pcard,
657 if (dev >= SNDRV_CARDS) 658 if (dev >= SNDRV_CARDS)
658 return -ENODEV; 659 return -ENODEV;
659 660
660 card = snd_cs423x_card_new(dev); 661 res = snd_cs423x_card_new(dev, &card);
661 if (! card) 662 if (res < 0)
662 return -ENOMEM; 663 return res;
663 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) {
664 printk(KERN_ERR "isapnp detection failed and probing for " IDENT 665 printk(KERN_ERR "isapnp detection failed and probing for " IDENT
665 " is not supported\n"); 666 " is not supported\n");
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c
index c24c6322fcc9..8cfbff73a835 100644
--- a/sound/isa/es18xx.c
+++ b/sound/isa/es18xx.c
@@ -2125,13 +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 struct snd_card *card; 2130 return snd_card_create(index[dev], id[dev], THIS_MODULE,
2131 if (snd_card_create(index[dev], id[dev], THIS_MODULE, 2131 sizeof(struct snd_audiodrive), cardp);
2132 sizeof(struct snd_audiodrive), &card) < 0)
2133 return NULL;
2134 return card;
2135} 2132}
2136 2133
2137static int __devinit snd_audiodrive_probe(struct snd_card *card, int dev) 2134static int __devinit snd_audiodrive_probe(struct snd_card *card, int dev)
@@ -2200,9 +2197,9 @@ static int __devinit snd_es18xx_isa_probe1(int dev, struct device *devptr)
2200 struct snd_card *card; 2197 struct snd_card *card;
2201 int err; 2198 int err;
2202 2199
2203 card = snd_es18xx_card_new(dev); 2200 err = snd_es18xx_card_new(dev, &card);
2204 if (! card) 2201 if (err < 0)
2205 return -ENOMEM; 2202 return err;
2206 snd_card_set_dev(card, devptr); 2203 snd_card_set_dev(card, devptr);
2207 if ((err = snd_audiodrive_probe(card, dev)) < 0) { 2204 if ((err = snd_audiodrive_probe(card, dev)) < 0) {
2208 snd_card_free(card); 2205 snd_card_free(card);
@@ -2306,9 +2303,9 @@ static int __devinit snd_audiodrive_pnp_detect(struct pnp_dev *pdev,
2306 if (dev >= SNDRV_CARDS) 2303 if (dev >= SNDRV_CARDS)
2307 return -ENODEV; 2304 return -ENODEV;
2308 2305
2309 card = snd_es18xx_card_new(dev); 2306 err = snd_es18xx_card_new(dev, &card);
2310 if (! card) 2307 if (err < 0)
2311 return -ENOMEM; 2308 return err;
2312 if ((err = snd_audiodrive_pnp(dev, card->private_data, pdev)) < 0) { 2309 if ((err = snd_audiodrive_pnp(dev, card->private_data, pdev)) < 0) {
2313 snd_card_free(card); 2310 snd_card_free(card);
2314 return err; 2311 return err;
@@ -2365,9 +2362,9 @@ static int __devinit snd_audiodrive_pnpc_detect(struct pnp_card_link *pcard,
2365 if (dev >= SNDRV_CARDS) 2362 if (dev >= SNDRV_CARDS)
2366 return -ENODEV; 2363 return -ENODEV;
2367 2364
2368 card = snd_es18xx_card_new(dev); 2365 res = snd_es18xx_card_new(dev, &card);
2369 if (! card) 2366 if (res < 0)
2370 return -ENOMEM; 2367 return res;
2371 2368
2372 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) {
2373 snd_card_free(card); 2370 snd_card_free(card);
diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c
index e040c7638911..50e429a120da 100644
--- a/sound/isa/gus/interwave.c
+++ b/sound/isa/gus/interwave.c
@@ -626,7 +626,7 @@ 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;
@@ -635,12 +635,13 @@ static struct snd_card *snd_interwave_card_new(int dev)
635 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 635 err = snd_card_create(index[dev], id[dev], THIS_MODULE,
636 sizeof(struct snd_interwave), &card); 636 sizeof(struct snd_interwave), &card);
637 if (err < 0) 637 if (err < 0)
638 return NULL; 638 return err;
639 iwcard = card->private_data; 639 iwcard = card->private_data;
640 iwcard->card = card; 640 iwcard->card = card;
641 iwcard->irq = -1; 641 iwcard->irq = -1;
642 card->private_free = snd_interwave_free; 642 card->private_free = snd_interwave_free;
643 return card; 643 *cardp = card;
644 return 0;
644} 645}
645 646
646static int __devinit snd_interwave_probe(struct snd_card *card, int dev) 647static int __devinit snd_interwave_probe(struct snd_card *card, int dev)
@@ -779,9 +780,9 @@ static int __devinit snd_interwave_isa_probe1(int dev, struct device *devptr)
779 struct snd_card *card; 780 struct snd_card *card;
780 int err; 781 int err;
781 782
782 card = snd_interwave_card_new(dev); 783 err = snd_interwave_card_new(dev, &card);
783 if (! card) 784 if (err < 0)
784 return -ENOMEM; 785 return err;
785 786
786 snd_card_set_dev(card, devptr); 787 snd_card_set_dev(card, devptr);
787 if ((err = snd_interwave_probe(card, dev)) < 0) { 788 if ((err = snd_interwave_probe(card, dev)) < 0) {
@@ -877,9 +878,9 @@ static int __devinit snd_interwave_pnp_detect(struct pnp_card_link *pcard,
877 if (dev >= SNDRV_CARDS) 878 if (dev >= SNDRV_CARDS)
878 return -ENODEV; 879 return -ENODEV;
879 880
880 card = snd_interwave_card_new(dev); 881 res = snd_interwave_card_new(dev, &card);
881 if (! card) 882 if (res < 0)
882 return -ENOMEM; 883 return res;
883 884
884 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) {
885 snd_card_free(card); 886 snd_card_free(card);
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c
index 5750f38bb797..87a4feb50109 100644
--- a/sound/isa/opti9xx/opti92x-ad1848.c
+++ b/sound/isa/opti9xx/opti92x-ad1848.c
@@ -830,17 +830,17 @@ 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;
837 836
838 err = snd_card_create(index, id, THIS_MODULE, 837 err = snd_card_create(index, id, THIS_MODULE,
839 sizeof(struct snd_opti9xx), &card); 838 sizeof(struct snd_opti9xx), &card);
840 if (err < 0) 839 if (err < 0)
841 return NULL; 840 return err;
842 card->private_free = snd_card_opti9xx_free; 841 card->private_free = snd_card_opti9xx_free;
843 return card; 842 *cardp = card;
843 return 0;
844} 844}
845 845
846static int __devinit snd_opti9xx_isa_match(struct device *devptr, 846static int __devinit snd_opti9xx_isa_match(struct device *devptr,
@@ -905,9 +905,9 @@ static int __devinit snd_opti9xx_isa_probe(struct device *devptr,
905 } 905 }
906#endif 906#endif
907 907
908 card = snd_opti9xx_card_new(); 908 error = snd_opti9xx_card_new(&card);
909 if (! card) 909 if (error < 0)
910 return -ENOMEM; 910 return error;
911 911
912 if ((error = snd_card_opti9xx_detect(card, card->private_data)) < 0) { 912 if ((error = snd_card_opti9xx_detect(card, card->private_data)) < 0) {
913 snd_card_free(card); 913 snd_card_free(card);
@@ -952,9 +952,9 @@ static int __devinit snd_opti9xx_pnp_probe(struct pnp_card_link *pcard,
952 return -EBUSY; 952 return -EBUSY;
953 if (! isapnp) 953 if (! isapnp)
954 return -ENODEV; 954 return -ENODEV;
955 card = snd_opti9xx_card_new(); 955 error = snd_opti9xx_card_new(&card);
956 if (! card) 956 if (error < 0)
957 return -ENOMEM; 957 return error;
958 chip = card->private_data; 958 chip = card->private_data;
959 959
960 hw = snd_card_opti9xx_pnp(chip, pcard, pid); 960 hw = snd_card_opti9xx_pnp(chip, pcard, pid);
diff --git a/sound/isa/sb/sb16.c b/sound/isa/sb/sb16.c
index adf4fdd2c4aa..519c36346dec 100644
--- a/sound/isa/sb/sb16.c
+++ b/sound/isa/sb/sb16.c
@@ -324,7 +324,7 @@ 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; 329 struct snd_card *card;
330 int err; 330 int err;
@@ -332,9 +332,10 @@ static struct snd_card *snd_sb16_card_new(int dev)
332 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 332 err = snd_card_create(index[dev], id[dev], THIS_MODULE,
333 sizeof(struct snd_card_sb16), &card); 333 sizeof(struct snd_card_sb16), &card);
334 if (err < 0) 334 if (err < 0)
335 return NULL; 335 return err;
336 card->private_free = snd_sb16_free; 336 card->private_free = snd_sb16_free;
337 return card; 337 *cardp = card;
338 return 0;
338} 339}
339 340
340static int __devinit snd_sb16_probe(struct snd_card *card, int dev) 341static int __devinit snd_sb16_probe(struct snd_card *card, int dev)
@@ -492,9 +493,9 @@ static int __devinit snd_sb16_isa_probe1(int dev, struct device *pdev)
492 struct snd_card *card; 493 struct snd_card *card;
493 int err; 494 int err;
494 495
495 card = snd_sb16_card_new(dev); 496 err = snd_sb16_card_new(dev, &card);
496 if (! card) 497 if (err < 0)
497 return -ENOMEM; 498 return err;
498 499
499 acard = card->private_data; 500 acard = card->private_data;
500 /* non-PnP FM port address is hardwired with base port address */ 501 /* non-PnP FM port address is hardwired with base port address */
@@ -613,9 +614,9 @@ static int __devinit snd_sb16_pnp_detect(struct pnp_card_link *pcard,
613 for ( ; dev < SNDRV_CARDS; dev++) { 614 for ( ; dev < SNDRV_CARDS; dev++) {
614 if (!enable[dev] || !isapnp[dev]) 615 if (!enable[dev] || !isapnp[dev])
615 continue; 616 continue;
616 card = snd_sb16_card_new(dev); 617 res = snd_sb16_card_new(dev, &card);
617 if (! card) 618 if (res < 0)
618 return -ENOMEM; 619 return res;
619 snd_card_set_dev(card, &pcard->card->dev); 620 snd_card_set_dev(card, &pcard->card->dev);
620 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 ||
621 (res = snd_sb16_probe(card, dev)) < 0) { 622 (res = snd_sb16_probe(card, dev)) < 0) {
diff --git a/sound/isa/wavefront/wavefront.c b/sound/isa/wavefront/wavefront.c
index 82b8fb746908..95898b2b7b58 100644
--- a/sound/isa/wavefront/wavefront.c
+++ b/sound/isa/wavefront/wavefront.c
@@ -338,7 +338,7 @@ 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;
@@ -347,7 +347,7 @@ static struct snd_card *snd_wavefront_card_new(int dev)
347 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 347 err = snd_card_create(index[dev], id[dev], THIS_MODULE,
348 sizeof(snd_wavefront_card_t), &card); 348 sizeof(snd_wavefront_card_t), &card);
349 if (err < 0) 349 if (err < 0)
350 return NULL; 350 return err;
351 351
352 acard = card->private_data; 352 acard = card->private_data;
353 acard->wavefront.irq = -1; 353 acard->wavefront.irq = -1;
@@ -358,7 +358,8 @@ static struct snd_card *snd_wavefront_card_new(int dev)
358 acard->wavefront.card = card; 358 acard->wavefront.card = card;
359 card->private_free = snd_wavefront_free; 359 card->private_free = snd_wavefront_free;
360 360
361 return card; 361 *cardp = card;
362 return 0;
362} 363}
363 364
364static int __devinit 365static int __devinit
@@ -568,9 +569,9 @@ static int __devinit snd_wavefront_isa_probe(struct device *pdev,
568 struct snd_card *card; 569 struct snd_card *card;
569 int err; 570 int err;
570 571
571 card = snd_wavefront_card_new(dev); 572 err = snd_wavefront_card_new(dev, &card);
572 if (! card) 573 if (err < 0)
573 return -ENOMEM; 574 return err;
574 snd_card_set_dev(card, pdev); 575 snd_card_set_dev(card, pdev);
575 if ((err = snd_wavefront_probe(card, dev)) < 0) { 576 if ((err = snd_wavefront_probe(card, dev)) < 0) {
576 snd_card_free(card); 577 snd_card_free(card);
@@ -617,9 +618,9 @@ static int __devinit snd_wavefront_pnp_detect(struct pnp_card_link *pcard,
617 if (dev >= SNDRV_CARDS) 618 if (dev >= SNDRV_CARDS)
618 return -ENODEV; 619 return -ENODEV;
619 620
620 card = snd_wavefront_card_new(dev); 621 res = snd_wavefront_card_new(dev, &card);
621 if (! card) 622 if (res < 0)
622 return -ENOMEM; 623 return res;
623 624
624 if (snd_wavefront_pnp (dev, card->private_data, pcard, pid) < 0) { 625 if (snd_wavefront_pnp (dev, card->private_data, pcard, pid) < 0) {
625 if (cs4232_pcm_port[dev] == SNDRV_AUTO_PORT) { 626 if (cs4232_pcm_port[dev] == SNDRV_AUTO_PORT) {