From 35ef1826906b5abfa0fc0c969ad29662fa83106d Mon Sep 17 00:00:00 2001 From: Xiang W Date: Mon, 10 Jul 2023 00:02:22 +0800 Subject: [PATCH] lib: sbi: print not fill '0' when left-aligned Left alignment and padding '0' should not exist at the same time, this patch skips padding. Signed-off-by: Xiang W Reviewed-by: Anup Patel --- lib/sbi/sbi_console.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/sbi/sbi_console.c b/lib/sbi/sbi_console.c index d87b5c20..03ee05a1 100644 --- a/lib/sbi/sbi_console.c +++ b/lib/sbi/sbi_console.c @@ -288,6 +288,8 @@ static int print(char **out, u32 *out_len, const char *format, va_list args) if (!flags_done) ++format; } + if (flags & PAD_RIGHT) + flags &= ~PAD_ZERO; /* Get width */ for (; *format >= '0' && *format <= '9'; ++format) { width *= 10;