mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-27 17:41:34 +00:00
efi_loader: allow device == NULL in efi_dp_from_name()
This is a preparatory patch for use in efi_serialize_load_option() as a load option's file_path should have both a device path and a file path. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
parent
b989648cf4
commit
2419b161cc
1 changed files with 7 additions and 4 deletions
|
@ -955,7 +955,7 @@ efi_status_t efi_dp_from_name(const char *dev, const char *devnr,
|
||||||
char filename[32] = { 0 }; /* dp->str is u16[32] long */
|
char filename[32] = { 0 }; /* dp->str is u16[32] long */
|
||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
if (!device || (path && !file))
|
if (path && !file)
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
|
|
||||||
is_net = !strcmp(dev, "Net");
|
is_net = !strcmp(dev, "Net");
|
||||||
|
@ -965,10 +965,12 @@ efi_status_t efi_dp_from_name(const char *dev, const char *devnr,
|
||||||
if (part < 0)
|
if (part < 0)
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
|
|
||||||
*device = efi_dp_from_part(desc, part);
|
if (device)
|
||||||
|
*device = efi_dp_from_part(desc, part);
|
||||||
} else {
|
} else {
|
||||||
#ifdef CONFIG_NET
|
#ifdef CONFIG_NET
|
||||||
*device = efi_dp_from_eth();
|
if (device)
|
||||||
|
*device = efi_dp_from_eth();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -985,7 +987,8 @@ efi_status_t efi_dp_from_name(const char *dev, const char *devnr,
|
||||||
s = filename;
|
s = filename;
|
||||||
while ((s = strchr(s, '/')))
|
while ((s = strchr(s, '/')))
|
||||||
*s++ = '\\';
|
*s++ = '\\';
|
||||||
*file = efi_dp_from_file(NULL, 0, filename);
|
*file = efi_dp_from_file(((!is_net && device) ? desc : NULL),
|
||||||
|
part, filename);
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue