commonlib/stdlib.h: Remove printf() from coreboot
coreboot should not have a definition of printf() anywhere -- it's too easy to accidentally sneak it into code otherwise. Where that is needed in code shared with userspace utilities, we should instead use printk() and define a shim for that for the userspace side. Change-Id: Iaa459df7122c88beb56695eee7c252d90bbde861 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/32857 Reviewed-by: Patrick Georgi <pgeorgi@google.com> Reviewed-by: HAOUAS Elyes <ehaouas@noos.fr> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
e8e92d60c4
commit
2b6da7f326
|
@ -38,11 +38,11 @@
|
||||||
#if CONFIG(COREBOOT_BUILD)
|
#if CONFIG(COREBOOT_BUILD)
|
||||||
#include <console/console.h>
|
#include <console/console.h>
|
||||||
#include <halt.h>
|
#include <halt.h>
|
||||||
#define printf(...) printk(BIOS_ERR, __VA_ARGS__)
|
|
||||||
#define HALT(x) halt()
|
#define HALT(x) halt()
|
||||||
#else
|
#else
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#define HALT(x)
|
#define printk(level, ...) printf(__VA_ARGS__)
|
||||||
|
#define HALT(x) abort()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static inline void *xmalloc_work(size_t size, const char *file,
|
static inline void *xmalloc_work(size_t size, const char *file,
|
||||||
|
@ -50,7 +50,7 @@ static inline void *xmalloc_work(size_t size, const char *file,
|
||||||
{
|
{
|
||||||
void *ret = malloc(size);
|
void *ret = malloc(size);
|
||||||
if (!ret && size) {
|
if (!ret && size) {
|
||||||
printf("%s/%s/line %d: Failed to malloc %zu bytes\n",
|
printk(BIOS_ERR, "%s/%s/line %d: Failed to malloc %zu bytes\n",
|
||||||
file, func, line, size);
|
file, func, line, size);
|
||||||
while (1)
|
while (1)
|
||||||
HALT(1);
|
HALT(1);
|
||||||
|
|
Loading…
Reference in New Issue