Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Mar 2001 21:42:34 -0500 (EST)
From:      Jim Bloom <bloom@jbloom.jbloom.org>
To:        current@freebsd.org
Subject:   page fault in mpu.c
Message-ID:  <200103270242.f2R2gYG00483@jbloom.jbloom.org>

next in thread | raw e-mail | index | archive | help
I finally tracked down the page fault I was seeing while probing the mpu.
The mutex was not being initialized before it was used.  I have included a
patch below which fixes the problem.  Will someone please review the style
and commit the fix.

Thanks.

Jim Bloom
bloom@acm.org


Index: mpu.c
===================================================================
RCS file: /users/ncvs/src/sys/dev/sound/isa/mpu.c,v
retrieving revision 1.5
diff -u -r1.5 mpu.c
--- mpu.c	2001/03/14 07:29:46	1.5
+++ mpu.c	2001/03/27 02:20:29
@@ -358,6 +358,8 @@
 
 	DEB(printf("mpu: attaching.\n"));
 
+	mtx_init(&scp->mtx, "mpumid", MTX_DEF);
+
 	/* Allocate the resources, switch to uart mode. */
 	if (mpu_allocres(scp, dev) || mpu_uartmode(scp)) {
 		mpu_releaseres(scp, dev);
@@ -368,7 +370,6 @@
 
 	/* Fill the softc. */
 	scp->dev = dev;
-	mtx_init(&scp->mtx, "mpumid", MTX_DEF);
 	scp->devinfo = devinfo = create_mididev_info_unit(MDT_MIDI, &mpu_op_desc, &midisynth_op_desc);
 
 	/* Fill the midi info. */
@@ -751,6 +752,7 @@
 		bus_release_resource(dev, SYS_RES_IOPORT, scp->io_rid, scp->io);
 		scp->io = NULL;
 	}
+	mtx_destroy(&scp->mtx);
 }
 
 static device_method_t mpu_methods[] = {

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200103270242.f2R2gYG00483>