public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Zeng, Star" <star.zeng@intel.com>
To: "Bi, Dandan" <dandan.bi@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Wu, Hao A" <hao.a.wu@intel.com>,
	Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	"Zeng, Star" <star.zeng@intel.com>
Subject: Re: [patch] MdeModulePkg/NonDiscoverable: Use compare operator for comparison
Date: Tue, 1 Jan 2019 13:17:20 +0000	[thread overview]
Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483104023A6FD@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <20181228085429.47056-2-dandan.bi@intel.com>

  if (Attributes) {
      if ((Attributes & (~(DEV_SUPPORTED_ATTRIBUTES))) != 0) {
        return EFI_UNSUPPORTED;
      }
    }

If ((Attributes & (~(DEV_SUPPORTED_ATTRIBUTES))) != 0) is TRUE, the Attributes must be not 0.
So " if (Attributes " could be removed.

BTW: This code block has indentation problem.


With them handled, Reviewed-by: Star Zeng <star.zeng@intel.com>


Thanks,
Star
-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Dandan Bi
Sent: Friday, December 28, 2018 4:54 PM
To: edk2-devel@lists.01.org
Cc: Wu, Hao A <hao.a.wu@intel.com>
Subject: [edk2] [patch] MdeModulePkg/NonDiscoverable: Use compare operator for comparison

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1422

According to EDK II C Coding Standards Specification, Non-Boolean comparisons must use a compare operator.
This patch is to update the code to follow EDKII coding style.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao Wu <hao.a.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 .../NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c
index f0d3472ea5..a0fe3b9ffa 100644
--- a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c
+++ b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePc
+++ iDeviceIo.c
@@ -1274,11 +1274,11 @@ PciIoAttributes (
   #define DEV_SUPPORTED_ATTRIBUTES \
     (EFI_PCI_DEVICE_ENABLE | EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE)
 
   Dev = NON_DISCOVERABLE_PCI_DEVICE_FROM_PCI_IO(This);
 
-  if (Attributes) {
+  if (Attributes != 0) {
       if ((Attributes & (~(DEV_SUPPORTED_ATTRIBUTES))) != 0) {
         return EFI_UNSUPPORTED;
       }
     }
 
--
2.18.0.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


  parent reply	other threads:[~2019-01-01 13:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-28  8:54 [patch] BaseTools/VfrCompile: report error for Integer overflow Dandan Bi
2018-12-28  8:54 ` [patch] MdeModulePkg/NonDiscoverable: Use compare operator for comparison Dandan Bi
2018-12-29  0:43   ` Wang, Jian J
2019-01-01 13:17   ` Zeng, Star [this message]
2019-01-02  1:42     ` Bi, Dandan
2019-01-07 14:30 ` [patch] BaseTools/VfrCompile: report error for Integer overflow Gao, Liming

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=0C09AFA07DD0434D9E2A0C6AEB0483104023A6FD@shsmsx102.ccr.corp.intel.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