From 4977ee965f110069bf5e8a66f7d4b345995ef282 Mon Sep 17 00:00:00 2001 From: Hao Wu Date: Mon, 11 Jan 2016 00:34:15 +0000 Subject: MdeModulePkg BaseSerialPortLib: Fix VS2010 build error 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 Reviewed-by: Star Zeng git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19628 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c b/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c index f4fc31913b..0ccac96f41 100644 --- a/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c +++ b/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c @@ -2,7 +2,7 @@ 16550 UART Serial Port library functions (C) Copyright 2014 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
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 @@ -1006,9 +1006,6 @@ SerialPortSetAttributes ( break; } } else { - if ((*Parity < NoParity) || (*Parity > SpaceParity)) { - return RETURN_INVALID_PARAMETER; - } switch (*Parity) { case NoParity: LcrParity = 0; @@ -1031,7 +1028,7 @@ SerialPortSetAttributes ( break; default: - break; + return RETURN_INVALID_PARAMETER; } } @@ -1054,9 +1051,6 @@ SerialPortSetAttributes ( break; } } else { - if ((*StopBits < OneStopBit) || (*StopBits > TwoStopBits)) { - return RETURN_INVALID_PARAMETER; - } switch (*StopBits) { case OneStopBit: LcrStop = 0; @@ -1068,7 +1062,7 @@ SerialPortSetAttributes ( break; default: - break; + return RETURN_INVALID_PARAMETER; } } -- cgit v1.2.3