diff mbox series

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

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

Commit Message

Alex Kiernan April 19, 2018, 4:32 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>
---

Changes in v2: None

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

Comments

Tom Rini April 29, 2018, 9:04 p.m. UTC | #1
On Thu, Apr 19, 2018 at 04:32:56AM +0000, Alex Kiernan wrote:

> We had two implementations of __assert_failed which were almost identical,
> combine them into one.
> 
> Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/lib/panic.c b/lib/panic.c
index 0efa134..bae8a35 100644
--- a/lib/panic.c
+++ b/lib/panic.c
@@ -45,3 +45,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 e29377e..5f7e27d 100644
--- a/lib/tiny-printf.c
+++ b/lib/tiny-printf.c
@@ -383,12 +383,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 9f0ce8a..8514f50 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -827,14 +827,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 */