"Das U-Boot" Source Tree
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Simon Glass and committed by
Tom Rini
19574e35 771f0e98

+8 -2
+8 -2
boot/bootdev-uclass.c
··· 16 16 #include <malloc.h> 17 17 #include <part.h> 18 18 #include <sort.h> 19 + #include <spl.h> 19 20 #include <dm/device-internal.h> 20 21 #include <dm/lists.h> 21 22 #include <dm/uclass-internal.h> ··· 278 279 int ret, len; 279 280 280 281 len = bootdev_get_suffix_start(blk, ".blk"); 281 - snprintf(dev_name, sizeof(dev_name), "%.*s.%s", len, blk->name, 282 - "bootdev"); 282 + if (xpl_phase() < PHASE_BOARD_R) { 283 + strlcpy(dev_name, blk->name, sizeof(dev_name) - 5); 284 + strcat(dev_name, ".sib"); 285 + } else { 286 + snprintf(dev_name, sizeof(dev_name), "%.*s.%s", len, blk->name, 287 + "bootdev"); 288 + } 283 289 284 290 parent = dev_get_parent(blk); 285 291 ret = device_find_child_by_name(parent, dev_name, &dev);