mirror of
https://github.com/reactos/reactos.git
synced 2025-04-21 20:50:29 +00:00
[NTOS]: Minor code formatting + don't leak a handle in case of failure, in CmpInitializeHardwareConfiguration().
svn path=/trunk/; revision=74733
This commit is contained in:
parent
8538be9a1f
commit
e5da5bc0d6
1 changed files with 20 additions and 8 deletions
|
@ -226,23 +226,25 @@ CmpSetupConfigurationTree(IN PCONFIGURATION_COMPONENT_DATA CurrentEntry,
|
||||||
{
|
{
|
||||||
/* EISA */
|
/* EISA */
|
||||||
case EisaAdapter:
|
case EisaAdapter:
|
||||||
|
{
|
||||||
/* Fixup information */
|
/* Fixup information */
|
||||||
Interface = Eisa;
|
Interface = Eisa;
|
||||||
Bus = CmpTypeCount[EisaAdapter]++;
|
Bus = CmpTypeCount[EisaAdapter]++;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* Turbo-channel */
|
/* Turbo-channel */
|
||||||
case TcAdapter:
|
case TcAdapter:
|
||||||
|
{
|
||||||
/* Fixup information */
|
/* Fixup information */
|
||||||
Interface = TurboChannel;
|
Interface = TurboChannel;
|
||||||
Bus = CmpTypeCount[TurboChannel]++;
|
Bus = CmpTypeCount[TurboChannel]++;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* ISA, PCI, etc busses */
|
/* ISA, PCI, etc busses */
|
||||||
case MultiFunctionAdapter:
|
case MultiFunctionAdapter:
|
||||||
|
{
|
||||||
/* Check if we have an identifier */
|
/* Check if we have an identifier */
|
||||||
if (Component->Identifier)
|
if (Component->Identifier)
|
||||||
{
|
{
|
||||||
|
@ -263,20 +265,24 @@ CmpSetupConfigurationTree(IN PCONFIGURATION_COMPONENT_DATA CurrentEntry,
|
||||||
Bus = CmpMultifunctionTypes[i].Count++;
|
Bus = CmpMultifunctionTypes[i].Count++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* SCSI Bus */
|
/* SCSI Bus */
|
||||||
case ScsiAdapter:
|
case ScsiAdapter:
|
||||||
|
{
|
||||||
/* Fix up */
|
/* Fix up */
|
||||||
Interface = Internal;
|
Interface = Internal;
|
||||||
Bus = CmpTypeCount[ScsiAdapter]++;
|
Bus = CmpTypeCount[ScsiAdapter]++;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* Unknown */
|
/* Unknown */
|
||||||
default:
|
default:
|
||||||
|
{
|
||||||
Interface = -1;
|
Interface = -1;
|
||||||
Bus = CmpUnknownBusCount++;
|
Bus = CmpUnknownBusCount++;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -344,7 +350,8 @@ CmpInitializeHardwareConfiguration(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
&Disposition);
|
&Disposition);
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status))
|
||||||
|
return Status;
|
||||||
NtClose(KeyHandle);
|
NtClose(KeyHandle);
|
||||||
|
|
||||||
/* Nobody should've created this key yet! */
|
/* Nobody should've created this key yet! */
|
||||||
|
@ -367,7 +374,8 @@ CmpInitializeHardwareConfiguration(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
&Disposition);
|
&Disposition);
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status))
|
||||||
|
return Status;
|
||||||
|
|
||||||
/* Nobody should've created this key yet! */
|
/* Nobody should've created this key yet! */
|
||||||
ASSERT(Disposition == REG_CREATED_NEW_KEY);
|
ASSERT(Disposition == REG_CREATED_NEW_KEY);
|
||||||
|
@ -376,7 +384,11 @@ CmpInitializeHardwareConfiguration(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||||
CmpConfigurationData = ExAllocatePoolWithTag(PagedPool,
|
CmpConfigurationData = ExAllocatePoolWithTag(PagedPool,
|
||||||
CmpConfigurationAreaSize,
|
CmpConfigurationAreaSize,
|
||||||
TAG_CM);
|
TAG_CM);
|
||||||
if (!CmpConfigurationData) return STATUS_INSUFFICIENT_RESOURCES;
|
if (!CmpConfigurationData)
|
||||||
|
{
|
||||||
|
NtClose(KeyHandle);
|
||||||
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
}
|
||||||
|
|
||||||
/* Check if we got anything from NTLDR */
|
/* Check if we got anything from NTLDR */
|
||||||
if (LoaderBlock->ConfigurationRoot)
|
if (LoaderBlock->ConfigurationRoot)
|
||||||
|
@ -393,7 +405,7 @@ CmpInitializeHardwareConfiguration(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Close our handle, free the buffer and return status */
|
/* Free the buffer, close our handle and return status */
|
||||||
ExFreePoolWithTag(CmpConfigurationData, TAG_CM);
|
ExFreePoolWithTag(CmpConfigurationData, TAG_CM);
|
||||||
NtClose(KeyHandle);
|
NtClose(KeyHandle);
|
||||||
return Status;
|
return Status;
|
||||||
|
|
Loading…
Reference in a new issue