]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
Update register hot key logic, return EFI_ALREADY_START status if same hot key alread...
[mirror_edk2.git] / MdeModulePkg / Universal / SetupBrowserDxe / Setup.c
index 579396293edf408c60dfff21f910531341df6a6d..43cfc87eeb3d2ce39d936257241522666fb9056c 100644 (file)
@@ -5890,6 +5890,7 @@ SetScope (
   @retval EFI_INVALID_PARAMETER  KeyData is NULL or HelpString is NULL on register.\r
   @retval EFI_NOT_FOUND          KeyData is not found to be unregistered.\r
   @retval EFI_UNSUPPORTED        Key represents a printable character. It is conflicted with Browser.\r
+  @retval EFI_ALREADY_STARTED    Key already been registered for one hot key.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -5935,20 +5936,19 @@ RegisterHotKey (
       return EFI_NOT_FOUND;\r
     }\r
   }\r
-  \r
+\r
+  if (HotKey != NULL) {\r
+    return EFI_ALREADY_STARTED;\r
+  }\r
+\r
   //\r
-  // Register HotKey into List.\r
+  // Create new Key, and add it into List.\r
   //\r
-  if (HotKey == NULL) {\r
-    //\r
-    // Create new Key, and add it into List.\r
-    //\r
-    HotKey = AllocateZeroPool (sizeof (BROWSER_HOT_KEY));\r
-    ASSERT (HotKey != NULL);\r
-    HotKey->Signature = BROWSER_HOT_KEY_SIGNATURE;\r
-    HotKey->KeyData   = AllocateCopyPool (sizeof (EFI_INPUT_KEY), KeyData);\r
-    InsertTailList (&gBrowserHotKeyList, &HotKey->Link);\r
-  }\r
+  HotKey = AllocateZeroPool (sizeof (BROWSER_HOT_KEY));\r
+  ASSERT (HotKey != NULL);\r
+  HotKey->Signature = BROWSER_HOT_KEY_SIGNATURE;\r
+  HotKey->KeyData   = AllocateCopyPool (sizeof (EFI_INPUT_KEY), KeyData);\r
+  InsertTailList (&gBrowserHotKeyList, &HotKey->Link);\r
 \r
   //\r
   // Fill HotKey information.\r