- netobj->parent.protocols[0].guid = &efi_net_guid;
- netobj->parent.protocols[0].protocol_interface = &netobj->net;
- netobj->parent.protocols[1].guid = &efi_guid_device_path;
- netobj->parent.protocols[1].protocol_interface =
- efi_dp_from_eth();
- netobj->parent.protocols[2].guid = &efi_pxe_guid;
- netobj->parent.protocols[2].protocol_interface = &netobj->pxe;
- netobj->parent.handle = &netobj->net;
+ r = efi_add_protocol(netobj->parent.handle, &efi_net_guid,
+ &netobj->net);
+ if (r != EFI_SUCCESS)
+ goto failure_to_add_protocol;
+ r = efi_add_protocol(netobj->parent.handle, &efi_guid_device_path,
+ efi_dp_from_eth());
+ if (r != EFI_SUCCESS)
+ goto failure_to_add_protocol;
+ r = efi_add_protocol(netobj->parent.handle, &efi_pxe_guid,
+ &netobj->pxe);
+ if (r != EFI_SUCCESS)
+ goto failure_to_add_protocol;