aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa/opl3sa2.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/isa/opl3sa2.c')
-rw-r--r--sound/isa/opl3sa2.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c
index c906e205d7d5..6d889052c32c 100644
--- a/sound/isa/opl3sa2.c
+++ b/sound/isa/opl3sa2.c
@@ -962,9 +962,11 @@ static int __init alsa_card_opl3sa2_init(void)
962#endif 962#endif
963 device = platform_device_register_simple(OPL3SA2_DRIVER, 963 device = platform_device_register_simple(OPL3SA2_DRIVER,
964 i, NULL, 0); 964 i, NULL, 0);
965 if (IS_ERR(device)) { 965 if (IS_ERR(device))
966 err = PTR_ERR(device); 966 continue;
967 goto errout; 967 if (!platform_get_drvdata(device)) {
968 platform_device_unregister(device);
969 continue;
968 } 970 }
969 platform_devices[i] = device; 971 platform_devices[i] = device;
970 snd_opl3sa2_devices++; 972 snd_opl3sa2_devices++;
@@ -983,14 +985,10 @@ static int __init alsa_card_opl3sa2_init(void)
983#ifdef MODULE 985#ifdef MODULE
984 snd_printk(KERN_ERR "Yamaha OPL3-SA soundcard not found or device busy\n"); 986 snd_printk(KERN_ERR "Yamaha OPL3-SA soundcard not found or device busy\n");
985#endif 987#endif
986 err = -ENODEV; 988 snd_opl3sa2_unregister_all();
987 goto errout; 989 return -ENODEV;
988 } 990 }
989 return 0; 991 return 0;
990
991 errout:
992 snd_opl3sa2_unregister_all();
993 return err;
994} 992}
995 993
996static void __exit alsa_card_opl3sa2_exit(void) 994static void __exit alsa_card_opl3sa2_exit(void)