[edk2] [PATCH v1 5/9] BaseTools: use dictionary.get() when we have value if not found

Jaben Carsey posted 9 patches 7 years, 2 months ago
[edk2] [PATCH v1 5/9] BaseTools: use dictionary.get() when we have value if not found
Posted by Jaben Carsey 7 years, 2 months ago
From: Jaben <jaben.carsey@intel.com>

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
---
 BaseTools/Source/Python/build/build.py | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py
index 6fb2e0ed3d09..ede963bc231a 100644
--- a/BaseTools/Source/Python/build/build.py
+++ b/BaseTools/Source/Python/build/build.py
@@ -1604,9 +1604,7 @@ class Build():
                         SmmModuleList[Module.MetaFile] = ImageInfo
                         SmmSize += ImageInfo.Image.Size
                         if Module.ModuleType == 'DXE_SMM_DRIVER':
-                            PiSpecVersion = '0x00000000'
-                            if 'PI_SPECIFICATION_VERSION' in Module.Module.Specification:
-                                PiSpecVersion = Module.Module.Specification['PI_SPECIFICATION_VERSION']
+                            PiSpecVersion = Module.Module.Specification.get('PI_SPECIFICATION_VERSION', '0x00000000')
                             # for PI specification < PI1.1, DXE_SMM_DRIVER also runs as BOOT time driver.
                             if int(PiSpecVersion, 16) < 0x0001000A:
                                 BtModuleList[Module.MetaFile] = ImageInfo
-- 
2.16.2.windows.1

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