]> git.sur5r.net Git - u-boot/commitdiff
dm: core: Drop use of strlcpy()
authorSimon Glass <sjg@chromium.org>
Wed, 2 Aug 2017 18:12:01 +0000 (12:12 -0600)
committerSimon Glass <sjg@chromium.org>
Tue, 12 Sep 2017 03:43:58 +0000 (21:43 -0600)
We can use printf() to limit the string width. Adjust the code to do this
instead of using strlcpy() which is a bit clumbsy.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
drivers/core/dump.c

index c3e109e7ed11c78632516c11e1ac78ca7f4b0e73..1bb64098f452c562f608ec9d9b4a4edb19814a2b 100644 (file)
@@ -14,11 +14,9 @@ static void show_devices(struct udevice *dev, int depth, int last_flag)
 {
        int i, is_last;
        struct udevice *child;
-       char class_name[12];
 
        /* print the first 11 characters to not break the tree-format. */
-       strlcpy(class_name, dev->uclass->uc_drv->name, sizeof(class_name));
-       printf(" %-11s [ %c ]    ", class_name,
+       printf(" %-10.10s [ %c ]    ", dev->uclass->uc_drv->name,
               dev->flags & DM_FLAG_ACTIVATED ? '+' : ' ');
 
        for (i = depth; i >= 0; i--) {
@@ -50,7 +48,7 @@ void dm_dump_all(void)
 
        root = dm_root();
        if (root) {
-               printf(" Class       Probed   Name\n");
+               printf(" Class      Probed   Name\n");
                printf("----------------------------------------\n");
                show_devices(root, -1, 0);
        }