patch-2.1.94 linux/drivers/sound/uart401.c
Next file: linux/drivers/sound/uart6850.c
Previous file: linux/drivers/sound/trix.c
Back to the patch index
Back to the overall index
- Lines: 63
- Date:
Wed Apr 8 17:24:48 1998
- Orig file:
v2.1.93/linux/drivers/sound/uart401.c
- Orig date:
Tue Mar 17 22:18:15 1998
diff -u --recursive --new-file v2.1.93/linux/drivers/sound/uart401.c linux/drivers/sound/uart401.c
@@ -12,7 +12,8 @@
*
* Changes:
* Alan Cox Reformatted, removed sound_mem usage, use normal Linux
- * interrupt allocation.
+ * interrupt allocation. Protect against bogus unload
+ * Fixed to allow IRQ > 15
*
* Status:
* Untested
@@ -244,6 +245,7 @@
uart401_devc *devc;
char *name = "MPU-401 (UART) MIDI";
+
if (hw_config->name)
name = hw_config->name;
@@ -269,12 +271,6 @@
else
devc->share_irq = 0;
- if (devc->irq < 1 || devc->irq > 15)
- {
- kfree(devc);
- return;
- }
-
if (!devc->share_irq)
{
if (request_irq(devc->irq, uart401intr, 0, "MPU-401 UART", devc) < 0)
@@ -345,6 +341,7 @@
for (timeout = 30000; timeout > 0 && !output_ready(devc); timeout--);
devc->input_byte = 0;
uart401_cmd(devc, MPU_RESET);
+
/*
* Wait at least 25 msec. This method is not accurate so let's make the
* loop bit longer. Cannot sleep since this is called during boot.
@@ -387,6 +384,8 @@
DDB(printk("Entered probe_uart401()\n"));
+ /* Default to "not found" */
+ hw_config->slots[4] = -1;
detected_devc = NULL;
if (check_region(hw_config->io_base, 4))
@@ -415,6 +414,14 @@
void unload_uart401(struct address_info *hw_config)
{
uart401_devc *devc;
+ int n=hw_config->slots[4];
+
+ /* Not set up */
+ if(n==-1 || midi_devs[n]==NULL)
+ return;
+
+ /* Not allocated (erm ??) */
+
devc = midi_devs[hw_config->slots[4]]->devc;
if (devc == NULL)
return;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov