x86: Drop leading spaces in cpu_x86_get_desc()
authorSimon Glass <sjg@chromium.org>
Sun, 19 Mar 2017 18:59:20 +0000 (12:59 -0600)
committerBin Meng <bmeng.cn@gmail.com>
Tue, 18 Apr 2017 07:51:21 +0000 (15:51 +0800)
The Intel CPU name can have leading spaces. Remove them since they are not
useful.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
arch/x86/cpu/cpu_x86.c

index 8be14b5929110dd4dd29d107d4168630fb6b4065..b465b14a948ed715b170baecfedf4b34fa4b312d 100644 (file)
@@ -41,10 +41,14 @@ int cpu_x86_get_vendor(struct udevice *dev, char *buf, int size)
 
 int cpu_x86_get_desc(struct udevice *dev, char *buf, int size)
 {
+       char *ptr;
+
        if (size < CPU_MAX_NAME_LEN)
                return -ENOSPC;
 
-       cpu_get_name(buf);
+       ptr = cpu_get_name(buf);
+       if (ptr != buf)
+               strcpy(buf, ptr);
 
        return 0;
 }