
This is an uncommon but annoying case. Normal error handling will ensure it is reported, but it is useful to have a message which provides a little more detail.
Signed-off-by: Simon Glass sjg@chromium.org ---
common/malloc_simple.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/common/malloc_simple.c b/common/malloc_simple.c index 479a1e4..4621b6d 100644 --- a/common/malloc_simple.c +++ b/common/malloc_simple.c @@ -21,8 +21,11 @@ void *malloc_simple(size_t bytes) new_ptr = gd->malloc_ptr + bytes; debug("%s: size=%zx, ptr=%lx, limit=%lx\n", __func__, bytes, new_ptr, gd->malloc_limit); - if (new_ptr > gd->malloc_limit) + if (new_ptr > gd->malloc_limit) { + printf("Out of memory (%zu bytes, %lx requested)\n", bytes, + new_ptr); return NULL; + } ptr = map_sysmem(gd->malloc_base + gd->malloc_ptr, bytes); gd->malloc_ptr = ALIGN(new_ptr, sizeof(new_ptr));