[efi] Use efi_open_by_driver() for all by-driver protocol opens

Signed-off-by: Michael Brown <mcb30@ipxe.org>
pull/34/merge
Michael Brown 2025-03-23 18:06:15 +00:00
parent 4561a03766
commit 9dd30f11f7
7 changed files with 43 additions and 102 deletions

View File

@ -367,7 +367,6 @@ static struct net_device_operations mnpnet_operations = {
* @ret rc Return status code * @ret rc Return status code
*/ */
int mnpnet_start ( struct efi_device *efidev ) { int mnpnet_start ( struct efi_device *efidev ) {
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
EFI_HANDLE device = efidev->device; EFI_HANDLE device = efidev->device;
EFI_GUID *binding = &efi_managed_network_service_binding_protocol_guid; EFI_GUID *binding = &efi_managed_network_service_binding_protocol_guid;
EFI_SIMPLE_NETWORK_MODE mode; EFI_SIMPLE_NETWORK_MODE mode;
@ -408,13 +407,9 @@ int mnpnet_start ( struct efi_device *efidev ) {
} }
/* Open MNP protocol */ /* Open MNP protocol */
if ( ( efirc = bs->OpenProtocol ( efidev->child, if ( ( rc = efi_open_by_driver ( efidev->child,
&efi_managed_network_protocol_guid, &efi_managed_network_protocol_guid,
&u.interface, efi_image_handle, &u.interface ) ) != 0 ) {
efidev->child,
( EFI_OPEN_PROTOCOL_BY_DRIVER |
EFI_OPEN_PROTOCOL_EXCLUSIVE )))!=0){
rc = -EEFI ( efirc );
DBGC ( mnp, "MNP %s could not open MNP protocol: %s\n", DBGC ( mnp, "MNP %s could not open MNP protocol: %s\n",
efi_handle_name ( device ), strerror ( rc ) ); efi_handle_name ( device ), strerror ( rc ) );
goto err_open; goto err_open;
@ -464,8 +459,8 @@ int mnpnet_start ( struct efi_device *efidev ) {
err_ll_addr_len: err_ll_addr_len:
err_hw_addr_len: err_hw_addr_len:
err_mode: err_mode:
bs->CloseProtocol ( efidev->child, &efi_managed_network_protocol_guid, efi_close_by_driver ( efidev->child,
efi_image_handle, efidev->child ); &efi_managed_network_protocol_guid );
err_open: err_open:
efi_service_del ( device, binding, efidev->child ); efi_service_del ( device, binding, efidev->child );
err_service: err_service:
@ -482,7 +477,6 @@ int mnpnet_start ( struct efi_device *efidev ) {
* @v efidev EFI device * @v efidev EFI device
*/ */
void mnpnet_stop ( struct efi_device *efidev ) { void mnpnet_stop ( struct efi_device *efidev ) {
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
EFI_GUID *binding = &efi_managed_network_service_binding_protocol_guid; EFI_GUID *binding = &efi_managed_network_service_binding_protocol_guid;
struct net_device *netdev = efidev_get_drvdata ( efidev ); struct net_device *netdev = efidev_get_drvdata ( efidev );
struct mnp_nic *mnp = netdev->priv; struct mnp_nic *mnp = netdev->priv;
@ -491,8 +485,8 @@ void mnpnet_stop ( struct efi_device *efidev ) {
unregister_netdev ( netdev ); unregister_netdev ( netdev );
/* Close MNP protocol */ /* Close MNP protocol */
bs->CloseProtocol ( efidev->child, &efi_managed_network_protocol_guid, efi_close_by_driver ( efidev->child,
efi_image_handle, efidev->child ); &efi_managed_network_protocol_guid );
/* Remove MNP child (unless whole system shutdown is in progress) */ /* Remove MNP child (unless whole system shutdown is in progress) */
if ( ! efi_shutdown_in_progress ) if ( ! efi_shutdown_in_progress )

View File

@ -1270,12 +1270,10 @@ static struct net_device_operations nii_operations = {
* @ret rc Return status code * @ret rc Return status code
*/ */
int nii_start ( struct efi_device *efidev ) { int nii_start ( struct efi_device *efidev ) {
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
EFI_HANDLE device = efidev->device; EFI_HANDLE device = efidev->device;
struct net_device *netdev; struct net_device *netdev;
struct nii_nic *nii; struct nii_nic *nii;
void *interface; void *interface;
EFI_STATUS efirc;
int rc; int rc;
/* Allocate and initialise structure */ /* Allocate and initialise structure */
@ -1300,11 +1298,8 @@ int nii_start ( struct efi_device *efidev ) {
netdev->dev = &nii->dev; netdev->dev = &nii->dev;
/* Open NII protocol */ /* Open NII protocol */
if ( ( efirc = bs->OpenProtocol ( device, &efi_nii31_protocol_guid, if ( ( rc = efi_open_by_driver ( device, &efi_nii31_protocol_guid,
&interface, efi_image_handle, device, &interface ) ) != 0 ) {
( EFI_OPEN_PROTOCOL_BY_DRIVER |
EFI_OPEN_PROTOCOL_EXCLUSIVE )))!=0){
rc = -EEFI ( efirc );
DBGC ( nii, "NII %s cannot open NII protocol: %s\n", DBGC ( nii, "NII %s cannot open NII protocol: %s\n",
nii->dev.name, strerror ( rc ) ); nii->dev.name, strerror ( rc ) );
DBGC_EFI_OPENERS ( device, device, &efi_nii31_protocol_guid ); DBGC_EFI_OPENERS ( device, device, &efi_nii31_protocol_guid );
@ -1373,8 +1368,7 @@ int nii_start ( struct efi_device *efidev ) {
err_pci_open: err_pci_open:
err_hw_undi: err_hw_undi:
err_no_undi: err_no_undi:
bs->CloseProtocol ( device, &efi_nii31_protocol_guid, efi_close_by_driver ( device, &efi_nii31_protocol_guid );
efi_image_handle, device );
err_open_protocol: err_open_protocol:
list_del ( &nii->dev.siblings ); list_del ( &nii->dev.siblings );
netdev_nullify ( netdev ); netdev_nullify ( netdev );
@ -1389,7 +1383,6 @@ int nii_start ( struct efi_device *efidev ) {
* @v efidev EFI device * @v efidev EFI device
*/ */
void nii_stop ( struct efi_device *efidev ) { void nii_stop ( struct efi_device *efidev ) {
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
struct net_device *netdev = efidev_get_drvdata ( efidev ); struct net_device *netdev = efidev_get_drvdata ( efidev );
struct nii_nic *nii = netdev->priv; struct nii_nic *nii = netdev->priv;
EFI_HANDLE device = efidev->device; EFI_HANDLE device = efidev->device;
@ -1404,8 +1397,7 @@ void nii_stop ( struct efi_device *efidev ) {
nii_pci_close ( nii ); nii_pci_close ( nii );
/* Close NII protocol */ /* Close NII protocol */
bs->CloseProtocol ( device, &efi_nii31_protocol_guid, efi_close_by_driver ( device, &efi_nii31_protocol_guid );
efi_image_handle, device );
/* Free network device */ /* Free network device */
list_del ( &nii->dev.siblings ); list_del ( &nii->dev.siblings );

View File

@ -539,7 +539,6 @@ int snpnet_supported ( EFI_HANDLE device, EFI_GUID *protocol ) {
* @ret rc Return status code * @ret rc Return status code
*/ */
int snpnet_start ( struct efi_device *efidev ) { int snpnet_start ( struct efi_device *efidev ) {
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
EFI_HANDLE device = efidev->device; EFI_HANDLE device = efidev->device;
EFI_SIMPLE_NETWORK_MODE *mode; EFI_SIMPLE_NETWORK_MODE *mode;
struct net_device *netdev; struct net_device *netdev;
@ -549,12 +548,9 @@ int snpnet_start ( struct efi_device *efidev ) {
int rc; int rc;
/* Open SNP protocol */ /* Open SNP protocol */
if ( ( efirc = bs->OpenProtocol ( device, if ( ( rc = efi_open_by_driver ( device,
&efi_simple_network_protocol_guid, &efi_simple_network_protocol_guid,
&interface, efi_image_handle, device, &interface ) ) != 0 ) {
( EFI_OPEN_PROTOCOL_BY_DRIVER |
EFI_OPEN_PROTOCOL_EXCLUSIVE )))!=0){
rc = -EEFI ( efirc );
DBGC ( device, "SNP %s cannot open SNP protocol: %s\n", DBGC ( device, "SNP %s cannot open SNP protocol: %s\n",
efi_handle_name ( device ), strerror ( rc ) ); efi_handle_name ( device ), strerror ( rc ) );
DBGC_EFI_OPENERS ( device, device, DBGC_EFI_OPENERS ( device, device,
@ -644,8 +640,7 @@ int snpnet_start ( struct efi_device *efidev ) {
netdev_nullify ( netdev ); netdev_nullify ( netdev );
netdev_put ( netdev ); netdev_put ( netdev );
err_alloc: err_alloc:
bs->CloseProtocol ( device, &efi_simple_network_protocol_guid, efi_close_by_driver ( device, &efi_simple_network_protocol_guid );
efi_image_handle, device );
err_open_protocol: err_open_protocol:
return rc; return rc;
} }
@ -656,7 +651,6 @@ int snpnet_start ( struct efi_device *efidev ) {
* @v efidev EFI device * @v efidev EFI device
*/ */
void snpnet_stop ( struct efi_device *efidev ) { void snpnet_stop ( struct efi_device *efidev ) {
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
struct net_device *netdev = efidev_get_drvdata ( efidev ); struct net_device *netdev = efidev_get_drvdata ( efidev );
struct snp_nic *snp = netdev->priv; struct snp_nic *snp = netdev->priv;
EFI_HANDLE device = efidev->device; EFI_HANDLE device = efidev->device;
@ -681,6 +675,5 @@ void snpnet_stop ( struct efi_device *efidev ) {
netdev_put ( netdev ); netdev_put ( netdev );
/* Close SNP protocol */ /* Close SNP protocol */
bs->CloseProtocol ( device, &efi_simple_network_protocol_guid, efi_close_by_driver ( device, &efi_simple_network_protocol_guid );
efi_image_handle, device );
} }

View File

@ -229,13 +229,9 @@ static int usbio_open ( struct usbio_device *usbio, unsigned int interface ) {
} }
/* Open USB I/O protocol on this handle */ /* Open USB I/O protocol on this handle */
if ( ( efirc = bs->OpenProtocol ( intf->handle, if ( ( rc = efi_open_by_driver ( intf->handle,
&efi_usb_io_protocol_guid, &efi_usb_io_protocol_guid,
&u.interface, efi_image_handle, &u.interface ) ) != 0 ) {
intf->handle,
( EFI_OPEN_PROTOCOL_BY_DRIVER |
EFI_OPEN_PROTOCOL_EXCLUSIVE )))!=0){
rc = -EEFI ( efirc );
DBGC ( usbio, "USBIO %s cannot open ", DBGC ( usbio, "USBIO %s cannot open ",
efi_handle_name ( handle ) ); efi_handle_name ( handle ) );
DBGC ( usbio, "%s: %s\n", DBGC ( usbio, "%s: %s\n",
@ -259,7 +255,6 @@ static int usbio_open ( struct usbio_device *usbio, unsigned int interface ) {
* @v interface Interface number * @v interface Interface number
*/ */
static void usbio_close ( struct usbio_device *usbio, unsigned int interface ) { static void usbio_close ( struct usbio_device *usbio, unsigned int interface ) {
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
struct usbio_interface *intf = &usbio->interface[interface]; struct usbio_interface *intf = &usbio->interface[interface];
/* Sanity checks */ /* Sanity checks */
@ -274,8 +269,7 @@ static void usbio_close ( struct usbio_device *usbio, unsigned int interface ) {
return; return;
/* Close USB I/O protocol */ /* Close USB I/O protocol */
bs->CloseProtocol ( intf->handle, &efi_usb_io_protocol_guid, efi_close_by_driver ( intf->handle, &efi_usb_io_protocol_guid );
efi_image_handle, intf->handle );
} }
/****************************************************************************** /******************************************************************************
@ -1608,7 +1602,6 @@ static int usbio_interfaces ( struct usbio_device *usbio ) {
* @ret rc Return status code * @ret rc Return status code
*/ */
static int usbio_start ( struct efi_device *efidev ) { static int usbio_start ( struct efi_device *efidev ) {
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
EFI_HANDLE handle = efidev->device; EFI_HANDLE handle = efidev->device;
struct usbio_device *usbio; struct usbio_device *usbio;
struct usb_port *port; struct usb_port *port;
@ -1616,7 +1609,6 @@ static int usbio_start ( struct efi_device *efidev ) {
void *interface; void *interface;
EFI_USB_IO_PROTOCOL *io; EFI_USB_IO_PROTOCOL *io;
} u; } u;
EFI_STATUS efirc;
int rc; int rc;
/* Allocate and initialise structure */ /* Allocate and initialise structure */
@ -1630,12 +1622,8 @@ static int usbio_start ( struct efi_device *efidev ) {
INIT_LIST_HEAD ( &usbio->endpoints ); INIT_LIST_HEAD ( &usbio->endpoints );
/* Open USB I/O protocol */ /* Open USB I/O protocol */
if ( ( efirc = bs->OpenProtocol ( handle, &efi_usb_io_protocol_guid, if ( ( rc = efi_open_by_driver ( handle, &efi_usb_io_protocol_guid,
&u.interface, efi_image_handle, &u.interface ) ) != 0 ) {
handle,
( EFI_OPEN_PROTOCOL_BY_DRIVER |
EFI_OPEN_PROTOCOL_EXCLUSIVE )))!=0){
rc = -EEFI ( efirc );
DBGC ( usbio, "USBIO %s cannot open USB I/O protocol: %s\n", DBGC ( usbio, "USBIO %s cannot open USB I/O protocol: %s\n",
efi_handle_name ( handle ), strerror ( rc ) ); efi_handle_name ( handle ), strerror ( rc ) );
DBGC_EFI_OPENERS ( usbio, handle, &efi_usb_io_protocol_guid ); DBGC_EFI_OPENERS ( usbio, handle, &efi_usb_io_protocol_guid );
@ -1692,8 +1680,7 @@ static int usbio_start ( struct efi_device *efidev ) {
free ( usbio->config ); free ( usbio->config );
err_config: err_config:
list_del ( &usbio->dev.siblings ); list_del ( &usbio->dev.siblings );
bs->CloseProtocol ( handle, &efi_usb_io_protocol_guid, efi_close_by_driver ( handle, &efi_usb_io_protocol_guid );
efi_image_handle, handle );
err_open_usbio: err_open_usbio:
free ( usbio ); free ( usbio );
err_alloc: err_alloc:
@ -1706,7 +1693,6 @@ static int usbio_start ( struct efi_device *efidev ) {
* @v efidev EFI device * @v efidev EFI device
*/ */
static void usbio_stop ( struct efi_device *efidev ) { static void usbio_stop ( struct efi_device *efidev ) {
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
EFI_HANDLE handle = efidev->device; EFI_HANDLE handle = efidev->device;
struct usbio_device *usbio = efidev_get_drvdata ( efidev ); struct usbio_device *usbio = efidev_get_drvdata ( efidev );
@ -1716,8 +1702,7 @@ static void usbio_stop ( struct efi_device *efidev ) {
free ( usbio->path ); free ( usbio->path );
free ( usbio->config ); free ( usbio->config );
list_del ( &usbio->dev.siblings ); list_del ( &usbio->dev.siblings );
bs->CloseProtocol ( handle, &efi_usb_io_protocol_guid, efi_close_by_driver ( handle, &efi_usb_io_protocol_guid );
efi_image_handle, handle );
free ( usbio ); free ( usbio );
} }

View File

@ -1169,11 +1169,8 @@ int efi_file_install ( EFI_HANDLE handle ) {
* of calls to our DRIVER_STOP method when starting the EFI * of calls to our DRIVER_STOP method when starting the EFI
* shell. I have no idea why this is. * shell. I have no idea why this is.
*/ */
if ( ( efirc = bs->OpenProtocol ( handle, &efi_disk_io_protocol_guid, if ( ( rc = efi_open_by_driver ( handle, &efi_disk_io_protocol_guid,
&diskio.interface, efi_image_handle, &diskio.interface ) ) != 0 ) {
handle,
EFI_OPEN_PROTOCOL_BY_DRIVER ) ) != 0){
rc = -EEFI ( efirc );
DBGC ( handle, "Could not open disk I/O protocol: %s\n", DBGC ( handle, "Could not open disk I/O protocol: %s\n",
strerror ( rc ) ); strerror ( rc ) );
DBGC_EFI_OPENERS ( handle, handle, &efi_disk_io_protocol_guid ); DBGC_EFI_OPENERS ( handle, handle, &efi_disk_io_protocol_guid );
@ -1199,8 +1196,7 @@ int efi_file_install ( EFI_HANDLE handle ) {
efi_file_path_uninstall ( &efi_file_initrd ); efi_file_path_uninstall ( &efi_file_initrd );
err_initrd_install: err_initrd_install:
err_initrd_claim: err_initrd_claim:
bs->CloseProtocol ( handle, &efi_disk_io_protocol_guid, efi_close_by_driver ( handle, &efi_disk_io_protocol_guid );
efi_image_handle, handle );
err_open: err_open:
bs->UninstallMultipleProtocolInterfaces ( bs->UninstallMultipleProtocolInterfaces (
handle, handle,
@ -1228,8 +1224,7 @@ void efi_file_uninstall ( EFI_HANDLE handle ) {
efi_file_path_uninstall ( &efi_file_initrd ); efi_file_path_uninstall ( &efi_file_initrd );
/* Close our own disk I/O protocol */ /* Close our own disk I/O protocol */
bs->CloseProtocol ( handle, &efi_disk_io_protocol_guid, efi_close_by_driver ( handle, &efi_disk_io_protocol_guid );
efi_image_handle, handle );
/* We must install the file system protocol first, since /* We must install the file system protocol first, since
* otherwise the EDK2 code will attempt to helpfully uninstall * otherwise the EDK2 code will attempt to helpfully uninstall

View File

@ -902,11 +902,9 @@ static int efipci_supported ( EFI_HANDLE device ) {
* @ret rc Return status code * @ret rc Return status code
*/ */
static int efipci_start ( struct efi_device *efidev ) { static int efipci_start ( struct efi_device *efidev ) {
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
EFI_HANDLE device = efidev->device; EFI_HANDLE device = efidev->device;
struct efi_pci_device *efipci; struct efi_pci_device *efipci;
void *pci_io; void *pci_io;
EFI_STATUS efirc;
int rc; int rc;
/* Allocate PCI device */ /* Allocate PCI device */
@ -920,12 +918,9 @@ static int efipci_start ( struct efi_device *efidev ) {
if ( ( rc = efipci_info ( device, efipci ) ) != 0 ) if ( ( rc = efipci_info ( device, efipci ) ) != 0 )
goto err_info; goto err_info;
/* Open PCI device */ /* Open PCI I/O protocol */
if ( ( efirc = bs->OpenProtocol ( device, &efi_pci_io_protocol_guid, if ( ( rc = efi_open_by_driver ( device, &efi_pci_io_protocol_guid,
&pci_io, efi_image_handle, device, &pci_io ) ) != 0 ) {
( EFI_OPEN_PROTOCOL_BY_DRIVER |
EFI_OPEN_PROTOCOL_EXCLUSIVE )))!=0){
rc = -EEFI_PCI ( efirc );
DBGC ( device, "EFIPCI %s could not open PCI device: %s\n", DBGC ( device, "EFIPCI %s could not open PCI device: %s\n",
efi_handle_name ( device ), strerror ( rc ) ); efi_handle_name ( device ), strerror ( rc ) );
DBGC_EFI_OPENERS ( device, device, &efi_pci_io_protocol_guid ); DBGC_EFI_OPENERS ( device, device, &efi_pci_io_protocol_guid );
@ -960,8 +955,7 @@ static int efipci_start ( struct efi_device *efidev ) {
err_probe: err_probe:
list_del ( &efipci->pci.dev.siblings ); list_del ( &efipci->pci.dev.siblings );
err_find_driver: err_find_driver:
bs->CloseProtocol ( device, &efi_pci_io_protocol_guid, efi_close_by_driver ( device, &efi_pci_io_protocol_guid );
efi_image_handle, device );
err_open: err_open:
err_info: err_info:
free ( efipci ); free ( efipci );
@ -976,15 +970,13 @@ static int efipci_start ( struct efi_device *efidev ) {
*/ */
static void efipci_stop ( struct efi_device *efidev ) { static void efipci_stop ( struct efi_device *efidev ) {
struct efi_pci_device *efipci = efidev_get_drvdata ( efidev ); struct efi_pci_device *efipci = efidev_get_drvdata ( efidev );
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
EFI_HANDLE device = efidev->device; EFI_HANDLE device = efidev->device;
pci_remove ( &efipci->pci ); pci_remove ( &efipci->pci );
list_del ( &efipci->pci.dev.siblings ); list_del ( &efipci->pci.dev.siblings );
assert ( efipci->pci.dma.mapped == 0 ); assert ( efipci->pci.dma.mapped == 0 );
assert ( efipci->pci.dma.allocated == 0 ); assert ( efipci->pci.dma.allocated == 0 );
bs->CloseProtocol ( device, &efi_pci_io_protocol_guid, efi_close_by_driver ( device, &efi_pci_io_protocol_guid );
efi_image_handle, device );
free ( efipci ); free ( efipci );
} }

View File

@ -1916,22 +1916,16 @@ static int efi_snp_probe ( struct net_device *netdev, void *priv __unused ) {
* instances to prevent SnpDxe from attempting to bind to * instances to prevent SnpDxe from attempting to bind to
* them. * them.
*/ */
if ( ( efirc = bs->OpenProtocol ( snpdev->handle, if ( ( rc = efi_open_by_driver ( snpdev->handle,
&efi_nii_protocol_guid, &interface, &efi_nii_protocol_guid,
efi_image_handle, snpdev->handle, &interface ) ) != 0 ) {
( EFI_OPEN_PROTOCOL_BY_DRIVER |
EFI_OPEN_PROTOCOL_EXCLUSIVE )))!=0){
rc = -EEFI ( efirc );
DBGC ( snpdev, "SNPDEV %p could not open NII protocol: %s\n", DBGC ( snpdev, "SNPDEV %p could not open NII protocol: %s\n",
snpdev, strerror ( rc ) ); snpdev, strerror ( rc ) );
goto err_open_nii; goto err_open_nii;
} }
if ( ( efirc = bs->OpenProtocol ( snpdev->handle, if ( ( rc = efi_open_by_driver ( snpdev->handle,
&efi_nii31_protocol_guid, &interface, &efi_nii31_protocol_guid,
efi_image_handle, snpdev->handle, &interface ) ) != 0 ) {
( EFI_OPEN_PROTOCOL_BY_DRIVER |
EFI_OPEN_PROTOCOL_EXCLUSIVE )))!=0){
rc = -EEFI ( efirc );
DBGC ( snpdev, "SNPDEV %p could not open NII31 protocol: %s\n", DBGC ( snpdev, "SNPDEV %p could not open NII31 protocol: %s\n",
snpdev, strerror ( rc ) ); snpdev, strerror ( rc ) );
goto err_open_nii31; goto err_open_nii31;
@ -1967,11 +1961,9 @@ static int efi_snp_probe ( struct net_device *netdev, void *priv __unused ) {
leak |= efi_snp_hii_uninstall ( snpdev ); leak |= efi_snp_hii_uninstall ( snpdev );
efi_child_del ( efidev->device, snpdev->handle ); efi_child_del ( efidev->device, snpdev->handle );
err_efi_child_add: err_efi_child_add:
bs->CloseProtocol ( snpdev->handle, &efi_nii31_protocol_guid, efi_close_by_driver ( snpdev->handle, &efi_nii31_protocol_guid );
efi_image_handle, snpdev->handle );
err_open_nii31: err_open_nii31:
bs->CloseProtocol ( snpdev->handle, &efi_nii_protocol_guid, efi_close_by_driver ( snpdev->handle, &efi_nii_protocol_guid );
efi_image_handle, snpdev->handle );
err_open_nii: err_open_nii:
if ( ( efirc = bs->UninstallMultipleProtocolInterfaces ( if ( ( efirc = bs->UninstallMultipleProtocolInterfaces (
snpdev->handle, snpdev->handle,
@ -2060,10 +2052,8 @@ static void efi_snp_remove ( struct net_device *netdev, void *priv __unused ) {
if ( snpdev->package_list ) if ( snpdev->package_list )
leak |= efi_snp_hii_uninstall ( snpdev ); leak |= efi_snp_hii_uninstall ( snpdev );
efi_child_del ( snpdev->efidev->device, snpdev->handle ); efi_child_del ( snpdev->efidev->device, snpdev->handle );
bs->CloseProtocol ( snpdev->handle, &efi_nii_protocol_guid, efi_close_by_driver ( snpdev->handle, &efi_nii_protocol_guid );
efi_image_handle, snpdev->handle ); efi_close_by_driver ( snpdev->handle, &efi_nii31_protocol_guid );
bs->CloseProtocol ( snpdev->handle, &efi_nii31_protocol_guid,
efi_image_handle, snpdev->handle );
if ( ( ! efi_shutdown_in_progress ) && if ( ( ! efi_shutdown_in_progress ) &&
( ( efirc = bs->UninstallMultipleProtocolInterfaces ( ( ( efirc = bs->UninstallMultipleProtocolInterfaces (
snpdev->handle, snpdev->handle,