From owner-freebsd-current Mon Mar 26 18:43:55 2001 Delivered-To: freebsd-current@freebsd.org Received: from jbloom.jbloom.org (reyim.ne.mediaone.net [24.218.251.241]) by hub.freebsd.org (Postfix) with ESMTP id 423E437B718 for ; Mon, 26 Mar 2001 18:43:51 -0800 (PST) (envelope-from bloom@jbloom.jbloom.org) Received: (from bloom@localhost) by jbloom.jbloom.org (8.11.2/8.11.2) id f2R2gYG00483 for current@freebsd.org; Mon, 26 Mar 2001 21:42:34 -0500 (EST) (envelope-from bloom) Date: Mon, 26 Mar 2001 21:42:34 -0500 (EST) From: Jim Bloom Message-Id: <200103270242.f2R2gYG00483@jbloom.jbloom.org> To: current@freebsd.org Subject: page fault in mpu.c Reply-To: bloom@acm.org Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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