aboutsummaryrefslogtreecommitdiffstats
path: root/sound/oss/wavfront.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/oss/wavfront.c')
-rw-r--r--sound/oss/wavfront.c38
1 files changed, 27 insertions, 11 deletions
diff --git a/sound/oss/wavfront.c b/sound/oss/wavfront.c
index b92ba8921638..b1a4eeb9dc08 100644
--- a/sound/oss/wavfront.c
+++ b/sound/oss/wavfront.c
@@ -2434,7 +2434,7 @@ static int __init detect_wavefront (int irq, int io_base)
2434 consumes 16. 2434 consumes 16.
2435 */ 2435 */
2436 2436
2437 if (check_region (io_base, 16)) { 2437 if (!request_region (io_base, 16, "wavfront")) {
2438 printk (KERN_ERR LOGNAME "IO address range 0x%x - 0x%x " 2438 printk (KERN_ERR LOGNAME "IO address range 0x%x - 0x%x "
2439 "already in use - ignored\n", dev.base, 2439 "already in use - ignored\n", dev.base,
2440 dev.base+15); 2440 dev.base+15);
@@ -2466,10 +2466,13 @@ static int __init detect_wavefront (int irq, int io_base)
2466 } else { 2466 } else {
2467 printk (KERN_WARNING LOGNAME "not raw, but no " 2467 printk (KERN_WARNING LOGNAME "not raw, but no "
2468 "hardware version!\n"); 2468 "hardware version!\n");
2469 release_region (io_base, 16);
2469 return 0; 2470 return 0;
2470 } 2471 }
2471 2472
2472 if (!wf_raw) { 2473 if (!wf_raw) {
2474 /* will re-acquire region in install_wavefront() */
2475 release_region (io_base, 16);
2473 return 1; 2476 return 1;
2474 } else { 2477 } else {
2475 printk (KERN_INFO LOGNAME 2478 printk (KERN_INFO LOGNAME
@@ -2489,6 +2492,7 @@ static int __init detect_wavefront (int irq, int io_base)
2489 2492
2490 if (wavefront_hw_reset ()) { 2493 if (wavefront_hw_reset ()) {
2491 printk (KERN_WARNING LOGNAME "hardware reset failed\n"); 2494 printk (KERN_WARNING LOGNAME "hardware reset failed\n");
2495 release_region (io_base, 16);
2492 return 0; 2496 return 0;
2493 } 2497 }
2494 2498
@@ -2496,6 +2500,8 @@ static int __init detect_wavefront (int irq, int io_base)
2496 2500
2497 dev.has_fx = (detect_wffx () == 0); 2501 dev.has_fx = (detect_wffx () == 0);
2498 2502
2503 /* will re-acquire region in install_wavefront() */
2504 release_region (io_base, 16);
2499 return 1; 2505 return 1;
2500} 2506}
2501 2507
@@ -2804,17 +2810,27 @@ static int __init wavefront_init (int atboot)
2804} 2810}
2805 2811
2806static int __init install_wavefront (void) 2812static int __init install_wavefront (void)
2807
2808{ 2813{
2814 if (!request_region (dev.base+2, 6, "wavefront synth"))
2815 return -1;
2816
2817 if (dev.has_fx) {
2818 if (!request_region (dev.base+8, 8, "wavefront fx")) {
2819 release_region (dev.base+2, 6);
2820 return -1;
2821 }
2822 }
2823
2809 if ((dev.synth_dev = register_sound_synth (&wavefront_fops, -1)) < 0) { 2824 if ((dev.synth_dev = register_sound_synth (&wavefront_fops, -1)) < 0) {
2810 printk (KERN_ERR LOGNAME "cannot register raw synth\n"); 2825 printk (KERN_ERR LOGNAME "cannot register raw synth\n");
2811 return -1; 2826 goto err_out;
2812 } 2827 }
2813 2828
2814#if OSS_SUPPORT_LEVEL & OSS_SUPPORT_SEQ 2829#if OSS_SUPPORT_LEVEL & OSS_SUPPORT_SEQ
2815 if ((dev.oss_dev = sound_alloc_synthdev()) == -1) { 2830 if ((dev.oss_dev = sound_alloc_synthdev()) == -1) {
2816 printk (KERN_ERR LOGNAME "Too many sequencers\n"); 2831 printk (KERN_ERR LOGNAME "Too many sequencers\n");
2817 return -1; 2832 /* FIXME: leak: should unregister sound synth */
2833 goto err_out;
2818 } else { 2834 } else {
2819 synth_devs[dev.oss_dev] = &wavefront_operations; 2835 synth_devs[dev.oss_dev] = &wavefront_operations;
2820 } 2836 }
@@ -2827,20 +2843,20 @@ static int __init install_wavefront (void)
2827 sound_unload_synthdev (dev.oss_dev); 2843 sound_unload_synthdev (dev.oss_dev);
2828#endif /* OSS_SUPPORT_SEQ */ 2844#endif /* OSS_SUPPORT_SEQ */
2829 2845
2830 return -1; 2846 goto err_out;
2831 } 2847 }
2832 2848
2833 request_region (dev.base+2, 6, "wavefront synth");
2834
2835 if (dev.has_fx) {
2836 request_region (dev.base+8, 8, "wavefront fx");
2837 }
2838
2839 if (wavefront_config_midi ()) { 2849 if (wavefront_config_midi ()) {
2840 printk (KERN_WARNING LOGNAME "could not initialize MIDI.\n"); 2850 printk (KERN_WARNING LOGNAME "could not initialize MIDI.\n");
2841 } 2851 }
2842 2852
2843 return dev.oss_dev; 2853 return dev.oss_dev;
2854
2855err_out:
2856 release_region (dev.base+2, 6);
2857 if (dev.has_fx)
2858 release_region (dev.base+8, 8);
2859 return -1;
2844} 2860}
2845 2861
2846static void __exit uninstall_wavefront (void) 2862static void __exit uninstall_wavefront (void)