2.1.76 Oops fixed in sound module

Andrea Arcangeli (arcangeli@mbox.queen.it)
Tue, 30 Dec 1997 18:04:59 +0100 (CET)


This fix a bug in the sound module. The patch is not still perfect,
because - for example - if we alloc a synth_devs[0] and a synth_devs[1]
and then unload the synth_devs[0], the sound drivers will think that the
synth_devs[0] is alloced and the synth_devs[1] is unloded and this
condition probably return to Oops.

Andrea[s] Arcangeli

--- dev_table.c 1997/12/30 16:48:15 1.1
+++ dev_table.c 1997/12/30 16:55:02
@@ -10,6 +10,10 @@
* Version 2 (June 1991). See the "COPYING" file distributed with this software
* for more info.
*/
+
+/*
+ * fixed unload functions, 1997 Andrea Arcangeli
+ */
#include <linux/config.h>


@@ -635,6 +639,8 @@
{
if (dev != -1)
mixer_devs[dev] = NULL;
+ if (dev < num_mixers)
+ num_mixers--;
}

void
@@ -651,6 +657,8 @@
{
if (dev != -1)
synth_devs[dev] = NULL;
+ if (dev < num_synths)
+ num_synths--;
}

void
@@ -658,4 +666,6 @@
{
if (dev != -1)
sound_timer_devs[dev] = NULL;
+ if (dev < num_sound_timers)
+ num_sound_timers--;
}