mirror of
https://github.com/u-boot/u-boot.git
synced 2025-05-09 03:21:51 +00:00
bootstd: Avoid sprintf() in SPL when creating bootdevs
The name of the bootdev device is not that important, particular in SPL. Save a little code space by using a simpler name. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
771f0e9877
commit
19574e35f4
1 changed files with 8 additions and 2 deletions
|
@ -16,6 +16,7 @@
|
|||
#include <malloc.h>
|
||||
#include <part.h>
|
||||
#include <sort.h>
|
||||
#include <spl.h>
|
||||
#include <dm/device-internal.h>
|
||||
#include <dm/lists.h>
|
||||
#include <dm/uclass-internal.h>
|
||||
|
@ -278,8 +279,13 @@ int bootdev_setup_for_sibling_blk(struct udevice *blk, const char *drv_name)
|
|||
int ret, len;
|
||||
|
||||
len = bootdev_get_suffix_start(blk, ".blk");
|
||||
snprintf(dev_name, sizeof(dev_name), "%.*s.%s", len, blk->name,
|
||||
"bootdev");
|
||||
if (xpl_phase() < PHASE_BOARD_R) {
|
||||
strlcpy(dev_name, blk->name, sizeof(dev_name) - 5);
|
||||
strcat(dev_name, ".sib");
|
||||
} else {
|
||||
snprintf(dev_name, sizeof(dev_name), "%.*s.%s", len, blk->name,
|
||||
"bootdev");
|
||||
}
|
||||
|
||||
parent = dev_get_parent(blk);
|
||||
ret = device_find_child_by_name(parent, dev_name, &dev);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue