From: Simon Glass Date: Thu, 19 Dec 2024 18:28:52 +0000 (-0700) Subject: bootstd: Avoid sprintf() in SPL when creating bootdevs X-Git-Tag: v2025.04-rc1~27^2~45 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=19574e35f46ce2b24fd5f9cacb09260226d1b9f5;p=pandora-u-boot.git 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 --- diff --git a/boot/bootdev-uclass.c b/boot/bootdev-uclass.c index 64ec4fde493..2e61c853142 100644 --- a/boot/bootdev-uclass.c +++ b/boot/bootdev-uclass.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -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);