]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1) Update some comment.
authorqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 9 Sep 2008 02:39:44 +0000 (02:39 +0000)
committerqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 9 Sep 2008 02:39:44 +0000 (02:39 +0000)
2) Add in handle for the out_of_resource cases
3) Add in Done label to clean up the code.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5853 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Core/Dxe/Hand.h
MdeModulePkg/Core/Dxe/Hand/DriverSupport.c
MdeModulePkg/Core/Dxe/Hand/Notify.c

index 8be7e58d601c87d154fb3e2224a8c7ac6b29c93d..b73bad99e11be43c94b4fa81a54381dcaaf35dca 100644 (file)
@@ -41,7 +41,7 @@ typedef struct {
 #define PROTOCOL_ENTRY_SIGNATURE        EFI_SIGNATURE_32('p','r','t','e')\r
 typedef struct {\r
   UINTN               Signature;\r
-  LIST_ENTRY          AllEntries;             // All entries\r
+  LIST_ENTRY          AllEntries;             // Link Entry inserted to mProtocolDatabase\r
   EFI_GUID            ProtocolID;             // ID of the protocol\r
   LIST_ENTRY          Protocols;              // All protocol interfaces\r
   LIST_ENTRY          Notify;                 // Registerd notification handlers\r
@@ -55,8 +55,8 @@ typedef struct {
 #define PROTOCOL_INTERFACE_SIGNATURE  EFI_SIGNATURE_32('p','i','f','c')\r
 typedef struct {\r
   UINTN                       Signature;\r
-  IHANDLE                     *Handle;    // Back pointer\r
   LIST_ENTRY                  Link;       // Link on IHANDLE.Protocols\r
+  IHANDLE                     *Handle;    // Back pointer\r
   LIST_ENTRY                  ByProtocol; // Link on PROTOCOL_ENTRY.Protocols\r
   PROTOCOL_ENTRY              *Protocol;  // The protocol ID\r
   VOID                        *Interface; // The interface value\r
@@ -70,7 +70,7 @@ typedef struct {
 \r
 typedef struct {\r
   UINTN                       Signature;\r
-  LIST_ENTRY                  Link;\r
+  LIST_ENTRY                  Link;      //Link on PROTOCOL_INTERFACE.OpenList\r
 \r
   EFI_HANDLE                  AgentHandle;\r
   EFI_HANDLE                  ControllerHandle;\r
index 9db124c9f3f672190342a4274af8d42e808aec67..829215ba300a7e50eb8797a4f9ec4991967ab57d 100644 (file)
@@ -73,6 +73,10 @@ CoreConnectController (
   AlignedRemainingDevicePath = NULL;\r
   if (RemainingDevicePath != NULL) {\r
     AlignedRemainingDevicePath = DuplicateDevicePath (RemainingDevicePath);\r
+\r
+    if (AlignedRemainingDevicePath == NULL) {\r
+      return EFI_OUT_OF_RESOURCES;\r
+    }\r
   }\r
 \r
   //\r
@@ -138,6 +142,9 @@ CoreConnectController (
     // Allocate a handle buffer for ControllerHandle's children\r
     //\r
     ChildHandleBuffer = AllocatePool (ChildHandleCount * sizeof(EFI_HANDLE));\r
+    if (ChildHandleBuffer == NULL) {\r
+      return EFI_OUT_OF_RESOURCES;\r
+    }\r
 \r
     //\r
     // Fill in a handle buffer with ControllerHandle's children\r
index 5f4ae191c240ef025ca70025e43caa8780b36d08..407e3ff8ff0a0cd531c708adc5d10ddee6c08130 100644 (file)
@@ -1,5 +1,5 @@
 /** @file\r
-  UEFI notify infrastructure\r
+  Support functions for UEFI protocol notification infrastructure.\r
 \r
 Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
 All rights reserved. This program and the accompanying materials\r
@@ -213,8 +213,8 @@ CoreReinstallProtocolInterface (
   //\r
   Prot = CoreFindProtocolInterface (UserHandle, Protocol, OldInterface);\r
   if (Prot == NULL) {\r
-    CoreReleaseProtocolLock ();\r
-    return EFI_NOT_FOUND;\r
+    Status = EFI_NOT_FOUND;\r
+    goto Done;\r
   }\r
 \r
   //\r
@@ -228,8 +228,7 @@ CoreReinstallProtocolInterface (
     //\r
     // One or more drivers refused to release, so return the error\r
     //\r
-    CoreReleaseProtocolLock ();\r
-    return Status;\r
+    goto Done;\r
   }\r
 \r
   //\r
@@ -238,8 +237,8 @@ CoreReinstallProtocolInterface (
   Prot = CoreRemoveInterfaceFromProtocol (Handle, Protocol, OldInterface);\r
 \r
   if (Prot == NULL) {\r
-    CoreReleaseProtocolLock ();\r
-    return EFI_NOT_FOUND;\r
+    Status = EFI_NOT_FOUND;\r
+    goto Done;\r
   }\r
 \r
   ProtEntry = Prot->Protocol;\r
@@ -265,12 +264,15 @@ CoreReinstallProtocolInterface (
   // Release the lock and connect all drivers to UserHandle\r
   //\r
   CoreReleaseProtocolLock ();\r
-  Status = CoreConnectController (\r
-             UserHandle,\r
-             NULL,\r
-             NULL,\r
-             TRUE\r
-             );\r
+  //\r
+  // Return code is ignored on purpose.\r
+  //\r
+  CoreConnectController (\r
+    UserHandle,\r
+    NULL,\r
+    NULL,\r
+    TRUE\r
+    );\r
   CoreAcquireProtocolLock ();\r
 \r
   //\r
@@ -280,5 +282,8 @@ CoreReinstallProtocolInterface (
 \r
   CoreReleaseProtocolLock ();\r
 \r
-  return EFI_SUCCESS;\r
+  Status = EFI_SUCCESS;\r
+\r
+Done:\r
+  return Status;\r
 }\r