]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/PciSioSerialDxe: Fix compiler warnings
authorMichael Kinney <michael.d.kinney@intel.com>
Mon, 14 Dec 2015 05:29:02 +0000 (05:29 +0000)
committererictian <erictian@Edk2>
Mon, 14 Dec 2015 05:29:02 +0000 (05:29 +0000)
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

MdeModulePkg/Bus/Pci/PciSioSerialDxe/Serial.c

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