From ebdb8247fd2618970201748cf021846882a05a6b Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Mon, 5 Dec 2011 03:00:24 +0100 Subject: [PATCH] Move mutex initialization earlier, analogous to hrev43320. Avoids crashing if the bus manager init fails. Also fixes CID 10846. --- src/add-ons/kernel/busses/usb/ehci.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/add-ons/kernel/busses/usb/ehci.cpp b/src/add-ons/kernel/busses/usb/ehci.cpp index 3ce830f32e..86ca3265fd 100644 --- a/src/add-ons/kernel/busses/usb/ehci.cpp +++ b/src/add-ons/kernel/busses/usb/ehci.cpp @@ -109,6 +109,7 @@ EHCI::EHCI(pci_info *info, Stack *stack) fPCIInfo(info), fStack(stack), fEnabledInterrupts(0), + fThreshold(0), fPeriodicFrameListArea(-1), fPeriodicFrameList(NULL), fInterruptEntries(NULL), @@ -136,6 +137,9 @@ EHCI::EHCI(pci_info *info, Stack *stack) fPortSuspendChange(0), fInterruptPollThread(-1) { + // Create a lock for the isochronous transfer list + mutex_init(&fIsochronousLock, "EHCI isochronous lock"); + if (BusManager::InitCheck() < B_OK) { TRACE_ERROR("bus manager failed to init\n"); return; @@ -305,9 +309,6 @@ EHCI::EHCI(pci_info *info, Stack *stack) B_NORMAL_PRIORITY, (void *)this); resume_thread(fFinishThread); - // Create a lock for the isochronous transfer list - mutex_init(&fIsochronousLock, "EHCI isochronous lock"); - // Create semaphore the isochronous finisher thread will wait for fFinishIsochronousTransfersSem = create_sem(0, "EHCI Isochronous Finish Transfers");