[PATCH v2 3/9] lib: Suppress E when writing error-string output

Simon Glass sjg at chromium.org
Sun Jul 30 19:15:13 CEST 2023


When CONFIG_ERRNO_STR is not enabled this shows a spurious 'E' from the
format string. Fix this.

Signed-off-by: Simon Glass <sjg at chromium.org>
Fixes: 7f331941321 ("lib: Support printing an error string")
---

(no changes since v1)

 lib/vsprintf.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index e87503e41ada..e14c6ca9f966 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -680,8 +680,10 @@ repeat:
 			break;
 
 		case 'd':
-			if (fmt[1] == 'E')
+			if (fmt[1] == 'E') {
 				flags |= ERRSTR;
+				fmt++;
+			}
 		/* fallthrough */
 		case 'i':
 			flags |= SIGN;
@@ -725,7 +727,6 @@ repeat:
 			ADDCH(str, ' ');
 			for (p = errno_str(num); *p; p++)
 				ADDCH(str, *p);
-			fmt++;
 		}
 	}
 
-- 
2.41.0.487.g6d72f3e995-goog



More information about the U-Boot mailing list