QuarkPlatformPkg/Tpm12DeviceLibAtmelI2c: Fix GCC build issues
authorMichael Kinney <michael.d.kinney@intel.com>
Tue, 10 Jan 2017 17:41:01 +0000 (09:41 -0800)
committerMichael Kinney <michael.d.kinney@intel.com>
Wed, 11 Jan 2017 19:11:30 +0000 (11:11 -0800)
https://bugzilla.tianocore.org/show_bug.cgi?id=335

Fix build issues with GCC49.  There are local variables that
may be used before initialized in some paths.

Cc: Kelly Steele <kelly.steele@intel.com>
Cc: Lee Leahy <leroy.p.leahy@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Lee Leahy <leroy.p.leahy@intel.com>
QuarkPlatformPkg/Library/Tpm12DeviceLibAtmelI2c/TisPc.c

index 3aab530..894e1e3 100644 (file)
@@ -59,6 +59,8 @@ WriteTpmBufferMultiple (
   UINTN                   Index;\r
   UINTN                   PartialLength;\r
 \r
+  Status = EFI_SUCCESS;\r
+\r
   I2CDeviceAddr.I2CDeviceAddress = ATMEL_I2C_TPM_SLAVE_ADDRESS;\r
 \r
   DEBUG ((EFI_D_VERBOSE, "WriteTpmBufferMultiple: Addr=%02x  Length=%02x\n", I2CDeviceAddr.I2CDeviceAddress, Length));\r
@@ -112,6 +114,8 @@ ReadTpmBufferMultiple (
   UINTN                   Index;\r
   UINTN                   PartialLength;\r
 \r
+  Status = EFI_SUCCESS;\r
+\r
   I2CDeviceAddr.I2CDeviceAddress = ATMEL_I2C_TPM_SLAVE_ADDRESS;\r
   WriteLength = 0;\r
 \r
@@ -262,6 +266,13 @@ Tpm12SubmitCommand (
   INT64                Cycle;\r
   INT64                Delta;\r
 \r
+  //\r
+  // Initialize local variables\r
+  //\r
+  Start   = 0;\r
+  End     = 0;\r
+  Total   = 0;\r
+\r
   //\r
   // Make sure response buffer is big enough to hold a response header\r
   //\r
@@ -275,13 +286,6 @@ Tpm12SubmitCommand (
   //\r
   Current = GetPerformanceCounter();\r
 \r
-  //\r
-  // Initialize local variables\r
-  //\r
-  Start = 0;\r
-  End   = 0;\r
-  Total = 0;\r
-\r
   //\r
   // Retrieve the performance counter properties and compute the number of\r
   // performance counter ticks required to reach the maximum TIS timeout of\r