Move mutex initialization earlier, analogous to hrev43320.

Avoids crashing if the bus manager init fails. Also fixes CID 10846.
This commit is contained in:
Michael Lotz
2011-12-05 03:00:24 +01:00
parent a395486027
commit ebdb8247fd
+4 -3
View File
@@ -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");