mirror of
https://github.com/AsahiLinux/u-boot
synced 2025-02-26 04:17:09 +00:00
efi_loader: simplify efi_dp_from_name()
Don't do the same check and assignment in multiple places. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
This commit is contained in:
parent
9f7ed4b469
commit
e1273ea2ec
1 changed files with 8 additions and 10 deletions
|
@ -1185,6 +1185,7 @@ efi_status_t efi_dp_from_name(const char *dev, const char *devnr,
|
||||||
struct efi_device_path **file)
|
struct efi_device_path **file)
|
||||||
{
|
{
|
||||||
struct blk_desc *desc = NULL;
|
struct blk_desc *desc = NULL;
|
||||||
|
struct efi_device_path *dp;
|
||||||
struct disk_partition fs_partition;
|
struct disk_partition fs_partition;
|
||||||
size_t image_size;
|
size_t image_size;
|
||||||
void *image_addr;
|
void *image_addr;
|
||||||
|
@ -1197,25 +1198,22 @@ efi_status_t efi_dp_from_name(const char *dev, const char *devnr,
|
||||||
/* loadm command and semihosting */
|
/* loadm command and semihosting */
|
||||||
efi_get_image_parameters(&image_addr, &image_size);
|
efi_get_image_parameters(&image_addr, &image_size);
|
||||||
|
|
||||||
if (device)
|
dp = efi_dp_from_mem(EFI_RESERVED_MEMORY_TYPE,
|
||||||
*device = efi_dp_from_mem(EFI_RESERVED_MEMORY_TYPE,
|
(uintptr_t)image_addr, image_size);
|
||||||
(uintptr_t)image_addr,
|
|
||||||
image_size);
|
|
||||||
} else if (IS_ENABLED(CONFIG_NETDEVICES) && !strcmp(dev, "Net")) {
|
} else if (IS_ENABLED(CONFIG_NETDEVICES) && !strcmp(dev, "Net")) {
|
||||||
if (device)
|
dp = efi_dp_from_eth();
|
||||||
*device = efi_dp_from_eth();
|
|
||||||
} else if (!strcmp(dev, "Uart")) {
|
} else if (!strcmp(dev, "Uart")) {
|
||||||
if (device)
|
dp = efi_dp_from_uart();
|
||||||
*device = efi_dp_from_uart();
|
|
||||||
} else {
|
} else {
|
||||||
part = blk_get_device_part_str(dev, devnr, &desc, &fs_partition,
|
part = blk_get_device_part_str(dev, devnr, &desc, &fs_partition,
|
||||||
1);
|
1);
|
||||||
if (part < 0 || !desc)
|
if (part < 0 || !desc)
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
|
|
||||||
if (device)
|
dp = efi_dp_from_part(desc, part);
|
||||||
*device = efi_dp_from_part(desc, part);
|
|
||||||
}
|
}
|
||||||
|
if (device)
|
||||||
|
*device = dp;
|
||||||
|
|
||||||
if (!path)
|
if (!path)
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
|
Loading…
Add table
Reference in a new issue