From a53a888de8f5fa8dbf75a381e28f25a5497572f1 Mon Sep 17 00:00:00 2001 From: Dandan Bi Date: Fri, 28 Dec 2018 13:17:50 +0800 Subject: [PATCH] MdeModulePkg/NonDiscoverablePciDevice: Remove the redundant check 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 @@ -1276,11 +1276,9 @@ PciIoAttributes ( 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) {