Agree, the logic could be simplified like your proposal.

Thanks
Feng

From: Simon (Xiang) Lian-SSI [mailto:[email protected]]
Sent: Friday, January 03, 2014 09:41
To: Tian, Feng
Cc: [email protected]
Subject: RE: Another bug in NVMe driver

Hi Feng,

One more thing is that in NvmExpressUnload, the following for loop doesn't seem 
to be necessary since we are uninstalling all protocols previously attached to 
this specific driver image handle, ie. DriverBinding->ImageHandle==ImageHandle, 
all other handles do not even need to be checked.

  for (Index = 0; Index < DeviceHandleCount; Index++) {
    Status = gBS->HandleProtocol (
                    DeviceHandleBuffer[Index],
                    &gEfiDriverBindingProtocolGuid,
                    (VOID **) &DriverBinding
                    );

    if (EFI_ERROR (Status)) {
      continue;
    }

    if (DriverBinding->ImageHandle != ImageHandle) {
      continue;
    }

    gBS->UninstallProtocolInterface (
           ImageHandle,
           &gEfiDriverBindingProtocolGuid,
           DriverBinding
           );

    Status = gBS->HandleProtocol (
                    DeviceHandleBuffer[Index],
                    &gEfiComponentNameProtocolGuid,
                    (VOID **) &ComponentName
                    );
    if (!EFI_ERROR (Status)) {
      gBS->UninstallProtocolInterface (
             ImageHandle,
             &gEfiComponentNameProtocolGuid,
             ComponentName
             );
}
... // Query and uninstall all other protocols


Therefore, can the above code be simply replaced with following?

  Status = gBS->UninstallMultipleProtocolInterfaces (
                  ImageHandle,
                  &gEfiDriverBindingProtocolGuid,
                  &gNvmExpressDriverBinding,
                  &gEfiComponentNameProtocolGuid,
                  &gNvmExpressComponentName,
                  &gEfiComponentName2ProtocolGuid,
                 &gNvmExpressComponentName2,
                  &gEfiDriverDiagnosticsProtocolGuid,
                  &gNvmExpressDriverDiagnostics,
                  &gEfiDriverDiagnostics2ProtocolGuid,
                  &gNvmExpressDriverDiagnostics2,
                  &gEfiDriverSupportedEfiVersionProtocolGuid,
                  &gNvmExpressDriverSupportedEfiVersion,
                  NULL
                  );


Thanks,
Simon


From: Tian, Feng [mailto:[email protected]]
Sent: Thursday, January 02, 2014 5:02 PM
To: Simon (Xiang) Lian-SSI
Cc: [email protected]<mailto:[email protected]>; 
Tian, Feng
Subject: RE: Another bug in NVMe driver

You are right. I will fix this issue as soon as possible.

Thanks
Feng

From: Simon (Xiang) Lian-SSI 
[mailto:[email protected]]<mailto:[mailto:[email protected]]>
Sent: Friday, January 03, 2014 06:41
To: Tian, Feng
Cc: [email protected]<mailto:[email protected]>
Subject: Another bug in NVMe driver

Hi Feng,

There seems to have a minor bug in current NVMe driver that 
DriverSupportedEfiVersion protocol hasn't been uninstalled in NvmExpressUnload, 
resulting in the driver image handle never gets freed up from the handle 
database.


Thanks,
Simon


------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to