mirror of
https://xff.cz/git/u-boot/
synced 2025-09-18 00:52:07 +02:00
efi_loader: return efi_status_t from efi_net_register
Consistently return status codes form efi_net_register(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
committed by
Alexander Graf
parent
80ea9b0990
commit
075d425d65
@@ -185,7 +185,7 @@ int efi_disk_create_partitions(efi_handle_t parent, struct blk_desc *desc,
|
|||||||
/* Called by bootefi to make GOP (graphical) interface available */
|
/* Called by bootefi to make GOP (graphical) interface available */
|
||||||
efi_status_t efi_gop_register(void);
|
efi_status_t efi_gop_register(void);
|
||||||
/* Called by bootefi to make the network interface available */
|
/* Called by bootefi to make the network interface available */
|
||||||
int efi_net_register(void);
|
efi_status_t efi_net_register(void);
|
||||||
/* Called by bootefi to make the watchdog available */
|
/* Called by bootefi to make the watchdog available */
|
||||||
int efi_watchdog_register(void);
|
int efi_watchdog_register(void);
|
||||||
/* Called by bootefi to make SMBIOS tables available */
|
/* Called by bootefi to make SMBIOS tables available */
|
||||||
|
@@ -280,20 +280,22 @@ static void EFIAPI efi_network_timer_notify(struct efi_event *event,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* This gets called from do_bootefi_exec(). */
|
/* This gets called from do_bootefi_exec(). */
|
||||||
int efi_net_register(void)
|
efi_status_t efi_net_register(void)
|
||||||
{
|
{
|
||||||
struct efi_net_obj *netobj;
|
struct efi_net_obj *netobj;
|
||||||
efi_status_t r;
|
efi_status_t r;
|
||||||
|
|
||||||
if (!eth_get_dev()) {
|
if (!eth_get_dev()) {
|
||||||
/* No eth device active, don't expose any */
|
/* No eth device active, don't expose any */
|
||||||
return 0;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We only expose the "active" eth device, so one is enough */
|
/* We only expose the "active" eth device, so one is enough */
|
||||||
netobj = calloc(1, sizeof(*netobj));
|
netobj = calloc(1, sizeof(*netobj));
|
||||||
if (!netobj)
|
if (!netobj) {
|
||||||
goto out_of_memory;
|
printf("ERROR: Out of memory\n");
|
||||||
|
return EFI_OUT_OF_RESOURCES;
|
||||||
|
}
|
||||||
|
|
||||||
/* Hook net up to the device list */
|
/* Hook net up to the device list */
|
||||||
efi_add_handle(&netobj->parent);
|
efi_add_handle(&netobj->parent);
|
||||||
@@ -302,15 +304,15 @@ int efi_net_register(void)
|
|||||||
r = efi_add_protocol(netobj->parent.handle, &efi_net_guid,
|
r = efi_add_protocol(netobj->parent.handle, &efi_net_guid,
|
||||||
&netobj->net);
|
&netobj->net);
|
||||||
if (r != EFI_SUCCESS)
|
if (r != EFI_SUCCESS)
|
||||||
goto out_of_memory;
|
goto failure_to_add_protocol;
|
||||||
r = efi_add_protocol(netobj->parent.handle, &efi_guid_device_path,
|
r = efi_add_protocol(netobj->parent.handle, &efi_guid_device_path,
|
||||||
efi_dp_from_eth());
|
efi_dp_from_eth());
|
||||||
if (r != EFI_SUCCESS)
|
if (r != EFI_SUCCESS)
|
||||||
goto out_of_memory;
|
goto failure_to_add_protocol;
|
||||||
r = efi_add_protocol(netobj->parent.handle, &efi_pxe_guid,
|
r = efi_add_protocol(netobj->parent.handle, &efi_pxe_guid,
|
||||||
&netobj->pxe);
|
&netobj->pxe);
|
||||||
if (r != EFI_SUCCESS)
|
if (r != EFI_SUCCESS)
|
||||||
goto out_of_memory;
|
goto failure_to_add_protocol;
|
||||||
netobj->net.revision = EFI_SIMPLE_NETWORK_PROTOCOL_REVISION;
|
netobj->net.revision = EFI_SIMPLE_NETWORK_PROTOCOL_REVISION;
|
||||||
netobj->net.start = efi_net_start;
|
netobj->net.start = efi_net_start;
|
||||||
netobj->net.stop = efi_net_stop;
|
netobj->net.stop = efi_net_stop;
|
||||||
@@ -366,8 +368,8 @@ int efi_net_register(void)
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return EFI_SUCCESS;
|
||||||
out_of_memory:
|
failure_to_add_protocol:
|
||||||
printf("ERROR: Out of memory\n");
|
printf("ERROR: Failure to add protocol\n");
|
||||||
return 1;
|
return r;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user