MdeModulePkg/PciSioSerialDxe: Fix compiler warnings

Add missing braces in module global mControllerDevicePathTemplate.
Initialize ControllerNumber and ContainsControllerNode in
SerialControllerDriverStart() to address warning for potential use
before initialization warning.
Move initialization of local SerialIo earlier in
SerialControllerDriverStart() to address warning for potential use
before initialization warning.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19232 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Michael Kinney 2015-12-14 05:29:02 +00:00 committed by erictian
parent c071461ebf
commit 83809dc018
1 changed files with 7 additions and 4 deletions

View File

@ -31,8 +31,10 @@ CONTROLLER_DEVICE_PATH mControllerDevicePathTemplate = {
{ {
HARDWARE_DEVICE_PATH, HARDWARE_DEVICE_PATH,
HW_CONTROLLER_DP, HW_CONTROLLER_DP,
sizeof (CONTROLLER_DEVICE_PATH), {
0 (UINT8) (sizeof (CONTROLLER_DEVICE_PATH)),
(UINT8) ((sizeof (CONTROLLER_DEVICE_PATH)) >> 8)
}
}, },
0 0
}; };
@ -858,7 +860,8 @@ SerialControllerDriverStart (
return EFI_SUCCESS; return EFI_SUCCESS;
} }
ControllerNumber = 0;
ContainsControllerNode = FALSE;
SerialDevices = GetChildSerialDevices (Controller, IoProtocolGuid, &SerialDeviceCount); SerialDevices = GetChildSerialDevices (Controller, IoProtocolGuid, &SerialDeviceCount);
// //
// If the SerialIo instance specified by RemainingDevicePath is already created, // If the SerialIo instance specified by RemainingDevicePath is already created,
@ -870,6 +873,7 @@ SerialControllerDriverStart (
if ((!SerialDevices[Index]->ContainsControllerNode && !ContainsControllerNode) || if ((!SerialDevices[Index]->ContainsControllerNode && !ContainsControllerNode) ||
(SerialDevices[Index]->ContainsControllerNode && ContainsControllerNode && SerialDevices[Index]->Instance == ControllerNumber) (SerialDevices[Index]->ContainsControllerNode && ContainsControllerNode && SerialDevices[Index]->Instance == ControllerNumber)
) { ) {
SerialIo = &SerialDevices[Index]->SerialIo;
Status = EFI_INVALID_PARAMETER; Status = EFI_INVALID_PARAMETER;
// //
// Pass NULL ActualBaudRate to VerifyUartParameters to disallow baudrate degrade. // Pass NULL ActualBaudRate to VerifyUartParameters to disallow baudrate degrade.
@ -877,7 +881,6 @@ SerialControllerDriverStart (
// //
if (VerifyUartParameters (SerialDevices[Index]->ClockRate, Uart->BaudRate, Uart->DataBits, if (VerifyUartParameters (SerialDevices[Index]->ClockRate, Uart->BaudRate, Uart->DataBits,
(EFI_PARITY_TYPE) Uart->Parity, (EFI_STOP_BITS_TYPE) Uart->StopBits, NULL, NULL)) { (EFI_PARITY_TYPE) Uart->Parity, (EFI_STOP_BITS_TYPE) Uart->StopBits, NULL, NULL)) {
SerialIo = &SerialDevices[Index]->SerialIo;
Status = SerialIo->SetAttributes ( Status = SerialIo->SetAttributes (
SerialIo, SerialIo,
Uart->BaudRate, Uart->BaudRate,