return snd_card_register(card);
}
-static int __devinit snd_wavefront_nonpnp_probe(struct platform_device *pdev)
+static int __init snd_wavefront_nonpnp_probe(struct platform_device *pdev)
{
int dev = pdev->id;
struct snd_card *card;
#ifdef CONFIG_PNP
-static unsigned int __devinitdata wavefront_pnp_devices;
static int __devinit snd_wavefront_pnp_detect(struct pnp_card_link *pcard,
const struct pnp_card_device_id *pid)
pnp_set_card_drvdata(pcard, card);
dev++;
- wavefront_pnp_devices++;
return 0;
}
if ((err = platform_driver_register(&snd_wavefront_driver)) < 0)
return err;
- for (i = 0; i < SNDRV_CARDS; i++) {
+ for (i = 0; i < SNDRV_CARDS && enable[i]; i++) {
struct platform_device *device;
- if (! enable[i])
- continue;
#ifdef CONFIG_PNP
if (isapnp[i])
continue;
#endif
device = platform_device_register_simple(WAVEFRONT_DRIVER,
i, NULL, 0);
- if (IS_ERR(device))
- continue;
- if (!platform_get_drvdata(device)) {
- platform_device_unregister(device);
- continue;
+ if (IS_ERR(device)) {
+ err = PTR_ERR(device);
+ goto errout;
}
platform_devices[i] = device;
cards++;
}
#ifdef CONFIG_PNP
- err = pnp_register_card_driver(&wavefront_pnpc_driver);
- if (!err) {
+ i = pnp_register_card_driver(&wavefront_pnpc_driver);
+ if (i >= 0) {
pnp_registered = 1;
- cards += wavefront_pnp_devices;
+ cards += i;
}
#endif
#ifdef MODULE
printk (KERN_ERR "No WaveFront cards found or devices busy\n");
#endif
- snd_wavefront_unregister_all();
- return -ENODEV;
+ err = -ENODEV;
+ goto errout;
}
return 0;
+
+ errout:
+ snd_wavefront_unregister_all();
+ return err;
}
static void __exit alsa_card_wavefront_exit(void)