]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Library/DxePlatDriOverLib/PlatDriOverLib.c
Move library class GenericBdsLib and PlatformBdsLib to IntelFrameworkModulePkg
[mirror_edk2.git] / MdeModulePkg / Library / DxePlatDriOverLib / PlatDriOverLib.c
index 30e5883d7ce3984ccb9adbe6665b22ab71b110e8..006de75ab4107464bc911063ca0173e210e19a6b 100644 (file)
@@ -80,7 +80,7 @@ FreeMappingDatabase (
 \r
 \r
 /**\r
-  Create the mappging database according to variable.\r
+  Create the mapping database according to variable.\r
 \r
   Read the environment variable(s) that contain the override mappings from Controller Device Path to\r
   a set of Driver Device Paths, and create the mapping database in memory with those variable info.\r
@@ -206,7 +206,7 @@ InitOverridesMapping (
       VariableIndex += ((sizeof(UINT32) - ((UINTN) (VariableIndex))) & (sizeof(UINT32) - 1));\r
 \r
       //\r
-      // Get all DriverDevicePath[]\r
+      // Get all DriverImageDevicePath[]\r
       //\r
       for (Index = 0; Index < DriverNumber; Index++) {\r
         //\r
@@ -240,10 +240,9 @@ InitOverridesMapping (
     // NotEnd indicates whether current variable is the end variable.\r
     //\r
     if (NotEnd != 0) {\r
-      UnicodeSPrint (OverrideVariableName, sizeof (OverrideVariableName), L"PlatDriOver%d", VariableNum);\r
+      UnicodeSPrint (OverrideVariableName, sizeof (OverrideVariableName), L"PlatDriOver%d", VariableNum++);\r
       VariableBuffer = GetVariableAndSize (OverrideVariableName, &gEfiOverrideVariableGuid, &BufferSize);\r
       ASSERT ((UINTN) VariableBuffer % sizeof(UINTN) == 0);\r
-      VariableNum++;\r
       if (VariableBuffer == NULL) {\r
         FreeMappingDatabase (MappingDataBase);\r
         return EFI_VOLUME_CORRUPTED;\r
@@ -468,6 +467,7 @@ SaveOverridesMapping (
     // ItemIndex now points to the next PLATFORM_OVERRIDE_ITEM which is not covered by VariableNeededSize\r
     //\r
     VariableBuffer = AllocateZeroPool (VariableNeededSize);\r
+    ASSERT (VariableBuffer != NULL);\r
     ASSERT ((UINTN) VariableBuffer % sizeof(UINTN) == 0);\r
 \r
     //\r
@@ -1215,7 +1215,7 @@ InsertDriverImage (
 \r
   if (!Found) {\r
     //\r
-    // if not find the wantted order location, add it as last item of the controller mapping item\r
+    // if not find the wanted order location, add it as last item of the controller mapping item\r
     //\r
     InsertTailList (&OverrideItem->DriverInfoList, &DriverImageInfo->Link);\r
     OverrideItem->DriverInfoNum ++;\r
@@ -1799,6 +1799,8 @@ ConnectDevicePath (
     // After this call DevicePath points to the next Instance\r
     //\r
     Instance  = GetNextDevicePathInstance (&DevicePath, &Size);\r
+    ASSERT (Instance != NULL);\r
+\r
     Next      = Instance;\r
     while (!IsDevicePathEndType (Next)) {\r
       Next = NextDevicePathNode (Next);\r