From 14d1b86bc5e669883d4021555bb617e5710bb176 Mon Sep 17 00:00:00 2001 From: tanimura Date: Tue, 3 Apr 2001 05:15:58 +0000 Subject: Again initialize a mutex well, then lock it. PR: kern/26188 Submitted by: Jim Bloom --- sys/dev/sound/isa/mpu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/dev/sound/isa/mpu.c b/sys/dev/sound/isa/mpu.c index d417513..0799da5 100644 --- a/sys/dev/sound/isa/mpu.c +++ b/sys/dev/sound/isa/mpu.c @@ -359,6 +359,8 @@ mpu_attach(device_t dev) 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); @@ -369,7 +371,6 @@ mpu_attach(device_t dev) /* 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. */ @@ -752,6 +753,7 @@ mpu_releaseres(sc_p scp, device_t dev) 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[] = { -- cgit v1.1