From mboxrd@z Thu Jan 1 00:00:00 1970 From: Simon Glass Date: Sun, 19 Mar 2017 12:59:20 -0600 Subject: [U-Boot] [PATCH 01/16] x86: Drop leading spaces in cpu_x86_get_desc() In-Reply-To: <20170319185935.20950-1-sjg@chromium.org> References: <20170319185935.20950-1-sjg@chromium.org> Message-ID: <20170319185935.20950-2-sjg@chromium.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de The Intel CPU name can have leading spaces. Remove them since they are not useful. Signed-off-by: Simon Glass --- arch/x86/cpu/cpu_x86.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/x86/cpu/cpu_x86.c b/arch/x86/cpu/cpu_x86.c index 8be14b5929..b465b14a94 100644 --- a/arch/x86/cpu/cpu_x86.c +++ b/arch/x86/cpu/cpu_x86.c @@ -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; } -- 2.12.0.367.g23dc2f6d3c-goog