public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Marvin Häuser" <Marvin.Haeuser@outlook.com>
To: "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "star.zeng@intel.com" <star.zeng@intel.com>,
	"eric.dong@intel.com" <eric.dong@intel.com>,
	"ruiyu.ni@intel.com" <ruiyu.ni@intel.com>
Subject: [PATCH 2/2] MdeModulePkg/BaseSerialPortLib16550: Prevent truncating constant values.
Date: Tue, 27 Feb 2018 16:49:56 +0000	[thread overview]
Message-ID: <AM4PR06MB1491AA67FE13BAC52CE3819A80C00@AM4PR06MB1491.eurprd06.prod.outlook.com> (raw)
In-Reply-To: <20180227164940.6956-1-Marvin.Haeuser@outlook.com>

The toolcahin VS2015x86 issues warnings when truncating constant
values. Explicitely cast such to avoid it.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marvin Haeuser <Marvin.Haeuser@outlook.com>
---
 MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c b/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c
index 0ccac96f419c..10eca6c0a7aa 100644
--- a/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c
+++ b/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c
@@ -366,7 +366,7 @@ GetSerialRegisterBase (
   //
   if (DeviceInfo->PowerManagementStatusAndControlRegister != 0x00) {
     if ((PciRead16 (PciLibAddress + DeviceInfo->PowerManagementStatusAndControlRegister) & (BIT0 | BIT1)) != 0x00) {
-      PciAnd16 (PciLibAddress + DeviceInfo->PowerManagementStatusAndControlRegister, (UINT16)~(BIT0 | BIT1));
+      PciAnd16 (PciLibAddress + DeviceInfo->PowerManagementStatusAndControlRegister, (UINT16)~(UINT16)(BIT0 | BIT1));
       //
       // If PCI UART was not in D0, then make sure FIFOs are enabled, but do not reset FIFOs
       //
@@ -402,7 +402,7 @@ GetSerialRegisterBase (
     //
     if (DeviceInfo->PowerManagementStatusAndControlRegister != 0x00) {
       if ((PciRead16 (PciLibAddress + DeviceInfo->PowerManagementStatusAndControlRegister) & (BIT0 | BIT1)) != 0x00) {
-        PciAnd16 (PciLibAddress + DeviceInfo->PowerManagementStatusAndControlRegister, (UINT16)~(BIT0 | BIT1));
+        PciAnd16 (PciLibAddress + DeviceInfo->PowerManagementStatusAndControlRegister, (UINT16)~(UINT16)(BIT0 | BIT1));
       }
     }
       
-- 
2.16.0.windows.2



       reply	other threads:[~2018-02-27 16:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20180227164940.6956-1-Marvin.Haeuser@outlook.com>
2018-02-27 16:49 ` Marvin Häuser [this message]
2018-02-27 18:35   ` [PATCH 2/2] MdeModulePkg/BaseSerialPortLib16550: Prevent truncating constant values Laszlo Ersek
2018-02-27 18:55     ` Marvin Häuser
2018-02-28  2:44       ` Zeng, Star
2018-03-01 17:34         ` Marvin Häuser
2018-03-02  2:01           ` Zeng, Star
2018-02-28 11:14       ` Laszlo Ersek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AM4PR06MB1491AA67FE13BAC52CE3819A80C00@AM4PR06MB1491.eurprd06.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox