diff mbox series

[U-Boot,v1,7/8] Consolidate __assert_failed into one implementation

Message ID 1524042143-30213-8-git-send-email-alex.kiernan@gmail.com
State Superseded
Delegated to: Tom Rini
Headers show
Series Fix SPL build without CONFIG_SPL_SERIAL_SUPPORT | expand

Commit Message

Alex Kiernan April 18, 2018, 9:02 a.m. UTC
We had two implementations of __assert_failed which were almost identical,
combine them into one.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
---

 lib/panic.c       | 8 ++++++++
 lib/tiny-printf.c | 9 ---------
 lib/vsprintf.c    | 8 --------
 3 files changed, 8 insertions(+), 17 deletions(-)
diff mbox series

Patch

diff --git a/lib/panic.c b/lib/panic.c
index 3ca6421..328cfae 100644
--- a/lib/panic.c
+++ b/lib/panic.c
@@ -46,3 +46,11 @@  void panic(const char *fmt, ...)
 #endif
 	panic_finish();
 }
+
+void __assert_fail(const char *assertion, const char *file, unsigned int line,
+		   const char *function)
+{
+	/* This will not return */
+	panic("%s:%u: %s: Assertion `%s' failed.", file, line, function,
+	      assertion);
+}
diff --git a/lib/tiny-printf.c b/lib/tiny-printf.c
index 9b97aed..030aef5 100644
--- a/lib/tiny-printf.c
+++ b/lib/tiny-printf.c
@@ -384,12 +384,3 @@  int snprintf(char *buf, size_t size, const char *fmt, ...)
 
 	return ret;
 }
-
-void __assert_fail(const char *assertion, const char *file, unsigned line,
-		   const char *function)
-{
-	/* This will not return */
-	printf("%s:%u: %s: Assertion `%s' failed.", file, line, function,
-	       assertion);
-	hang();
-}
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index bb0c573..9295d5f 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -828,14 +828,6 @@  int vprintf(const char *fmt, va_list args)
 }
 #endif
 
-void __assert_fail(const char *assertion, const char *file, unsigned line,
-		   const char *function)
-{
-	/* This will not return */
-	panic("%s:%u: %s: Assertion `%s' failed.", file, line, function,
-	      assertion);
-}
-
 char *simple_itoa(ulong i)
 {
 	/* 21 digits plus null terminator, good for 64-bit or smaller ints */