diff options
Diffstat (limited to 'sound/isa/sb/sb16.c')
-rw-r--r-- | sound/isa/sb/sb16.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/sound/isa/sb/sb16.c b/sound/isa/sb/sb16.c index 5737ab76160c..6333f900eaee 100644 --- a/sound/isa/sb/sb16.c +++ b/sound/isa/sb/sb16.c @@ -369,7 +369,7 @@ static struct snd_card *snd_sb16_card_new(int dev) return card; } -static int __init snd_sb16_probe(struct snd_card *card, int dev) +static int __devinit snd_sb16_probe(struct snd_card *card, int dev) { int xirq, xdma8, xdma16; struct snd_sb *chip; @@ -518,7 +518,7 @@ static int snd_sb16_resume(struct snd_card *card) } #endif -static int __init snd_sb16_nonpnp_probe1(int dev, struct platform_device *devptr) +static int __devinit snd_sb16_nonpnp_probe1(int dev, struct platform_device *devptr) { struct snd_card_sb16 *acard; struct snd_card *card; @@ -548,7 +548,7 @@ static int __init snd_sb16_nonpnp_probe1(int dev, struct platform_device *devptr } -static int __init snd_sb16_nonpnp_probe(struct platform_device *pdev) +static int __devinit snd_sb16_nonpnp_probe(struct platform_device *pdev) { int dev = pdev->id; int err; @@ -629,6 +629,7 @@ static struct platform_driver snd_sb16_nonpnp_driver = { #ifdef CONFIG_PNP +static unsigned int __devinitdata sb16_pnp_devices; static int __devinit snd_sb16_pnp_detect(struct pnp_card_link *pcard, const struct pnp_card_device_id *pid) @@ -651,6 +652,7 @@ static int __devinit snd_sb16_pnp_detect(struct pnp_card_link *pcard, } pnp_set_card_drvdata(pcard, card); dev++; + sb16_pnp_devices++; return 0; } @@ -718,19 +720,21 @@ static int __init alsa_card_sb16_init(void) continue; device = platform_device_register_simple(SND_SB16_DRIVER, i, NULL, 0); - if (IS_ERR(device)) { - err = PTR_ERR(device); - goto errout; + if (IS_ERR(device)) + continue; + if (!platform_get_drvdata(device)) { + platform_device_unregister(device); + continue; } platform_devices[i] = device; cards++; } #ifdef CONFIG_PNP /* PnP cards at last */ - i = pnp_register_card_driver(&sb16_pnpc_driver); - if (i >= 0) { + err = pnp_register_card_driver(&sb16_pnpc_driver); + if (!err) { pnp_registered = 1; - cards += i; + cards += sb16_pnp_devices; } #endif @@ -743,14 +747,10 @@ static int __init alsa_card_sb16_init(void) snd_printk(KERN_ERR "In case, if you have AWE card, try snd-sbawe module\n"); #endif #endif - err = -ENODEV; - goto errout; + snd_sb16_unregister_all(); + return -ENODEV; } return 0; - - errout: - snd_sb16_unregister_all(); - return err; } static void __exit alsa_card_sb16_exit(void) |