When overriding compiler options '/GL' with '/GL-', VS2010 will report
warning C4701 potentially uninitialized local variable for 'LcrParity'
and 'LcrStop' in function SerialPortSetAttributes().

This commit fixes this build issue.

Cc: Ruiyu Ni <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <[email protected]>
---
 PcAtChipsetPkg/Library/SerialIoLib/SerialPortLib.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/PcAtChipsetPkg/Library/SerialIoLib/SerialPortLib.c 
b/PcAtChipsetPkg/Library/SerialIoLib/SerialPortLib.c
index 8656785..1bbb1a2 100644
--- a/PcAtChipsetPkg/Library/SerialIoLib/SerialPortLib.c
+++ b/PcAtChipsetPkg/Library/SerialIoLib/SerialPortLib.c
@@ -1,7 +1,7 @@
 /** @file
   UART Serial Port library functions
 
-  Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at
@@ -417,14 +417,6 @@ SerialPortSetAttributes (
     return RETURN_INVALID_PARAMETER;
   }
 
-  if ((*Parity < NoParity) || (*Parity > SpaceParity)) {
-    return RETURN_INVALID_PARAMETER;
-  }
-
-  if ((*StopBits < OneStopBit) || (*StopBits > TwoStopBits)) {
-    return RETURN_INVALID_PARAMETER;
-  }
-
   //
   // Map 5..8 to 0..3
   //
@@ -452,7 +444,7 @@ SerialPortSetAttributes (
       break;
 
     default:
-      break;
+      return RETURN_INVALID_PARAMETER;
   }
 
   switch (*StopBits) {
@@ -466,7 +458,7 @@ SerialPortSetAttributes (
       break;
 
     default:
-      break;
+      return RETURN_INVALID_PARAMETER;
   }
 
   //
-- 
1.9.5.msysgit.0

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to