
From: Adam Belay <ambx1@neo.rr.com>

If !CONFIG_PNP, the sb16 driver registered resources dangling the kernel
oopses when reading /proc/ioports after module removal.



 sound/isa/sb/sb16.c |   13 +++++++++++++
 1 files changed, 13 insertions(+)

diff -puN sound/isa/sb/sb16.c~sb16-ioports-fix sound/isa/sb/sb16.c
--- 25/sound/isa/sb/sb16.c~sb16-ioports-fix	2003-07-27 20:31:12.000000000 -0700
+++ 25-akpm/sound/isa/sb/sb16.c	2003-07-27 20:31:12.000000000 -0700
@@ -350,6 +350,18 @@ __wt_error:
 
 #endif /* CONFIG_PNP */
 
+static void snd_sb16_free(snd_card_t *card)
+{
+	struct snd_card_sb16 *acard = (struct snd_card_sb16 *) card->private_data;
+
+	if (acard == NULL)
+		return;
+	if (acard->fm_res) {
+		release_resource(acard->fm_res);
+		kfree_nocheck(acard->fm_res);
+	}
+}
+
 static int __init snd_sb16_probe(int dev,
 				 struct pnp_card_link *pcard,
 				 const struct pnp_card_device_id *pid)
@@ -374,6 +386,7 @@ static int __init snd_sb16_probe(int dev
 	if (card == NULL)
 		return -ENOMEM;
 	acard = (struct snd_card_sb16 *) card->private_data;
+	card->private_free = snd_sb16_free;
 #ifdef CONFIG_PNP
 	if (isapnp[dev]) {
 		if ((err = snd_card_sb16_pnp(dev, acard, pcard, pid))) {

_
