]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg BaseSerialPortLib: Fix VS2010 build error
authorHao Wu <hao.a.wu@intel.com>
Mon, 11 Jan 2016 00:34:15 +0000 (00:34 +0000)
committerhwu1225 <hwu1225@Edk2>
Mon, 11 Jan 2016 00:34:15 +0000 (00:34 +0000)
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.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19628 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c

index f4fc31913bea7dca3d25ef5b14f343b07562bff5..0ccac96f419c48f171036a6f5fa05b92f6ff4003 100644 (file)
@@ -2,7 +2,7 @@
   16550 UART Serial Port library functions\r
 \r
   (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>\r
-  Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -1006,9 +1006,6 @@ SerialPortSetAttributes (
         break;\r
     }\r
   } else {\r
-    if ((*Parity < NoParity) || (*Parity > SpaceParity)) {\r
-      return RETURN_INVALID_PARAMETER;\r
-    }\r
     switch (*Parity) {\r
       case NoParity:\r
         LcrParity = 0;\r
@@ -1031,7 +1028,7 @@ SerialPortSetAttributes (
         break;\r
 \r
       default:\r
-        break;\r
+        return RETURN_INVALID_PARAMETER;\r
     }\r
   }\r
 \r
@@ -1054,9 +1051,6 @@ SerialPortSetAttributes (
         break;\r
     }\r
   } else {\r
-    if ((*StopBits < OneStopBit) || (*StopBits > TwoStopBits)) {\r
-      return RETURN_INVALID_PARAMETER;\r
-    }\r
     switch (*StopBits) {\r
       case OneStopBit:\r
         LcrStop = 0;\r
@@ -1068,7 +1062,7 @@ SerialPortSetAttributes (
         break;\r
 \r
       default:\r
-        break;\r
+        return RETURN_INVALID_PARAMETER;\r
     }\r
   }\r
 \r