From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.65; helo=mga03.intel.com; envelope-from=dandan.bi@intel.com; receiver=edk2-devel@lists.01.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id ECA2221962301 for ; Tue, 1 Jan 2019 17:50:48 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Jan 2019 17:50:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,429,1539673200"; d="scan'208";a="122641929" Received: from shwdeopenpsi114.ccr.corp.intel.com ([10.239.157.135]) by FMSMGA003.fm.intel.com with ESMTP; 01 Jan 2019 17:50:47 -0800 From: Dandan Bi To: edk2-devel@lists.01.org Cc: Vladimir Olovyannikov , Jian J Wang , Hao Wu , Ard Biesheuvel Date: Wed, 2 Jan 2019 09:50:37 +0800 Message-Id: <20190102015037.50956-1-dandan.bi@intel.com> X-Mailer: git-send-email 2.18.0.windows.1 Subject: [patch] MdeModulePkg/NonDiscoverablePciDevice: Remove the redundant check X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jan 2019 01:50:49 -0000 REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1422 if (Attributes) { if ((Attributes & (~(DEV_SUPPORTED_ATTRIBUTES))) != 0) { return EFI_UNSUPPORTED; } } In above code block, "If ((Attributes & (~(DEV_SUPPORTED_ATTRIBUTES))) != 0)" is TRUE, the Attributes must be not 0. So we can remove the redundant check "if (Attributes)". Cc: Vladimir Olovyannikov Cc: Jian J Wang Cc: Hao Wu Cc: Ard Biesheuvel Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi Reviewed-by: Star Zeng --- .../NonDiscoverablePciDeviceIo.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c index f0d3472ea5..2be8b36acc 100644 --- a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c +++ b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c @@ -1274,15 +1274,13 @@ 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 & (~(DEV_SUPPORTED_ATTRIBUTES))) != 0) { - return EFI_UNSUPPORTED; - } - } + if ((Attributes & (~(DEV_SUPPORTED_ATTRIBUTES))) != 0) { + return EFI_UNSUPPORTED; + } Enable = FALSE; switch (Operation) { case EfiPciIoAttributeOperationGet: if (Result == NULL) { -- 2.18.0.windows.1