summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorJoel Kitching <kitching@google.com>2019-07-22 14:21:35 +0800
committerCommit Bot <commit-bot@chromium.org>2019-07-24 06:53:41 +0000
commite050a2c88fc963cb97d9794849e9e2b60fabbe77 (patch)
treef037b8c93a7dc4b8a5d23c9b7a643d1dedfc71e0 /firmware
parent34abb32ed2e48ccad95320c37fb001df8e3442fd (diff)
downloadvboot-e050a2c88fc963cb97d9794849e9e2b60fabbe77.tar.gz
vboot: deprecate VbExError function
Convert uses of this function to call VB2_DEBUG and manually exit if necessary. BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: I9006b1a9c66645757d33310d96207233b88eaed5 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1710340 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
Diffstat (limited to 'firmware')
-rw-r--r--firmware/include/vboot_api.h9
-rw-r--r--firmware/lib/include/utility.h6
-rw-r--r--firmware/stub/vboot_api_stub_init.c28
3 files changed, 4 insertions, 39 deletions
diff --git a/firmware/include/vboot_api.h b/firmware/include/vboot_api.h
index 6142cfa7..518b8cd8 100644
--- a/firmware/include/vboot_api.h
+++ b/firmware/include/vboot_api.h
@@ -309,15 +309,6 @@ VbError_t VbVerifyMemoryBootImage(struct vb2_context *ctx,
VbError_t VbUnlockDevice(void);
/*****************************************************************************/
-/* Debug output (from utility.h) */
-
-/**
- * Output an error message and quit. Does not return. Supports
- * printf()-style formatting.
- */
-void VbExError(const char *format, ...);
-
-/*****************************************************************************/
/* Timer and delay (first two from utility.h) */
#define VB_USEC_PER_MSEC 1000ULL
diff --git a/firmware/lib/include/utility.h b/firmware/lib/include/utility.h
index 10562a58..272b9f42 100644
--- a/firmware/lib/include/utility.h
+++ b/firmware/lib/include/utility.h
@@ -11,13 +11,15 @@
#ifndef VBOOT_REFERENCE_UTILITY_H_
#define VBOOT_REFERENCE_UTILITY_H_
+#include "2common.h"
#include "sysincludes.h"
#include "vboot_api.h"
#ifdef VBOOT_DEBUG
#define VbAssert(expr) do { if (!(expr)) { \
- VbExError("assert fail: %s at %s:%d\n", \
- #expr, __FILE__, __LINE__); }} while(0)
+ VB2_DEBUG("assert fail: %s at %s:%d\n", \
+ #expr, __FILE__, __LINE__); \
+ exit(1); }} while(0)
#else
#define VbAssert(expr)
#endif
diff --git a/firmware/stub/vboot_api_stub_init.c b/firmware/stub/vboot_api_stub_init.c
index 23ae9f78..0f7a3482 100644
--- a/firmware/stub/vboot_api_stub_init.c
+++ b/firmware/stub/vboot_api_stub_init.c
@@ -15,34 +15,6 @@
#include "vboot_api.h"
-/* U-Boot's printf uses '%L' for uint64_t. gcc uses '%l'. */
-#define MAX_FMT 255
-static char fmtbuf[MAX_FMT+1];
-
-static const char *fixfmt(const char *format)
-{
- int i;
- for(i=0; i<sizeof(fmtbuf)-1 && format[i]; i++) {
- fmtbuf[i] = format[i];
- if(format[i] == '%' && format[i+1] == 'L') {
- fmtbuf[i+1] = 'l';
- i++;
- }
- }
- fmtbuf[i] = '\0';
- return fmtbuf;
-}
-
-void VbExError(const char *format, ...)
-{
- va_list ap;
- va_start(ap, format);
- fprintf(stderr, "ERROR: ");
- vfprintf(stderr, fixfmt(format), ap);
- va_end(ap);
- exit(1);
-}
-
uint64_t VbExGetTimer(void)
{
struct timeval tv;