lib: sbi: print not fill '0' when left-aligned
authorXiang W <wxjstz@126.com>
Sun, 9 Jul 2023 16:02:22 +0000 (00:02 +0800)
committerAnup Patel <anup@brainfault.org>
Wed, 12 Jul 2023 04:18:49 +0000 (09:48 +0530)
Left alignment and padding '0' should not exist at the same time,
this patch skips padding.

Signed-off-by: Xiang W <wxjstz@126.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
lib/sbi/sbi_console.c

index d87b5c20efc303daef52e8243c36f98c5a18f530..03ee05a11cb7cc4c58c9b0d6c0582f1f9411743e 100644 (file)
@@ -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;