linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / sound / isa / sb / sb8.c
index 141400c..60ee79c 100644 (file)
@@ -258,17 +258,13 @@ static int __init alsa_card_sb8_init(void)
                return err;
 
        cards = 0;
-       for (i = 0; i < SNDRV_CARDS; i++) {
+       for (i = 0; i < SNDRV_CARDS && enable[i]; i++) {
                struct platform_device *device;
-               if (! enable[i])
-                       continue;
                device = platform_device_register_simple(SND_SB8_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;
                }
                devices[i] = device;
                cards++;
@@ -277,10 +273,14 @@ static int __init alsa_card_sb8_init(void)
 #ifdef MODULE
                snd_printk(KERN_ERR "Sound Blaster soundcard not found or device busy\n");
 #endif
-               snd_sb8_unregister_all();
-               return -ENODEV;
+               err = -ENODEV;
+               goto errout;
        }
        return 0;
+
+ errout:
+       snd_sb8_unregister_all();
+       return err;
 }
 
 static void __exit alsa_card_sb8_exit(void)