From: Laszlo Ersek <lersek@redhat.com>
To: "Marvin Häuser" <Marvin.Haeuser@outlook.com>,
"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "ruiyu.ni@intel.com" <ruiyu.ni@intel.com>,
"eric.dong@intel.com" <eric.dong@intel.com>,
"star.zeng@intel.com" <star.zeng@intel.com>
Subject: Re: [PATCH 1/2] MdeModulePkg/PciBusDxe: Prevent truncating constant values.
Date: Tue, 27 Feb 2018 19:42:07 +0100 [thread overview]
Message-ID: <657bb4e2-7271-6a24-7cd3-aecdaaa005f5@redhat.com> (raw)
In-Reply-To: <AM4PR06MB1491FD43ADA90A28F8B4922780C00@AM4PR06MB1491.eurprd06.prod.outlook.com>
On 02/27/18 17:49, Marvin Häuser wrote:
> 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/Bus/Pci/PciBusDxe/PciResourceSupport.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.c
> index 2f713fcee95e..a752853f3e9e 100644
> --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.c
> +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.c
> @@ -1936,7 +1936,7 @@ ProgramP2C (
> &BridgeControl
> );
>
> - BridgeControl &= (UINT16) ~PCI_CARD_PREFETCHABLE_MEMORY_0_ENABLE;
> + BridgeControl &= (UINT16) ~(UINT16)PCI_CARD_PREFETCHABLE_MEMORY_0_ENABLE;
> PciIo->Pci.Write (
> PciIo,
> EfiPciIoWidthUint16,
> @@ -2005,7 +2005,7 @@ ProgramP2C (
> &BridgeControl
> );
>
> - BridgeControl &= (UINT16) ~(PCI_CARD_PREFETCHABLE_MEMORY_1_ENABLE);
> + BridgeControl &= (UINT16) ~(UINT16)(PCI_CARD_PREFETCHABLE_MEMORY_1_ENABLE);
> PciIo->Pci.Write (
> PciIo,
> EfiPciIoWidthUint16,
>
My recommendation is the same as for:
[edk2] [PATCH 2/2] MdeModulePkg/BaseSerialPortLib16550: Prevent
truncating constant values.
#define PCI_CARD_PREFETCHABLE_MEMORY_0_ENABLE BIT8
#define PCI_CARD_PREFETCHABLE_MEMORY_1_ENABLE BIT9
#define BIT8 0x00000100
#define BIT9 0x00000200
So I suggest (UINT32) for the casts.
I'd also suggest a better subject line / commit message. Can we say:
Package/Module: avoid bit-negating signed integer constants
and then the commit message could quote the VS2015x86 warnings.
Again, just my two cents; I defer to the MdeModulePkg maintainers.
Thanks!
Laszlo
next prev parent reply other threads:[~2018-02-27 18:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-27 16:49 [PATCH 1/2] MdeModulePkg/PciBusDxe: Prevent truncating constant values Marvin Häuser
2018-02-27 18:42 ` Laszlo Ersek [this message]
2018-02-27 18:50 ` Andrew Fish
2018-02-27 18:57 ` Marvin Häuser
2018-02-28 11:42 ` Laszlo Ersek
2018-02-28 11:48 ` Marvin Häuser
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=657bb4e2-7271-6a24-7cd3-aecdaaa005f5@redhat.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