aboutsummaryrefslogtreecommitdiff
path: root/arch/sandbox/cpu
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2020-06-04 19:28:22 +0200
committerSimon Glass <sjg@chromium.org>2020-07-09 18:57:21 -0600
commitc7e49ddc613534f2eb4286ae100fbc90938f160f (patch)
treed583aff17a3298be87e2bd2b318ee49f587c18bc /arch/sandbox/cpu
parent506d52308a2f5de48c2b9a08229fee9a0ee2842a (diff)
downloadu-boot-c7e49ddc613534f2eb4286ae100fbc90938f160f.zip
u-boot-c7e49ddc613534f2eb4286ae100fbc90938f160f.tar.gz
u-boot-c7e49ddc613534f2eb4286ae100fbc90938f160f.tar.bz2
sandbox: handling out of memory
assert() only works in debug mode. So checking a successful memory allocation should not use assert(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'arch/sandbox/cpu')
-rw-r--r--arch/sandbox/cpu/state.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/sandbox/cpu/state.c b/arch/sandbox/cpu/state.c
index 1f79412..34b6fff 100644
--- a/arch/sandbox/cpu/state.c
+++ b/arch/sandbox/cpu/state.c
@@ -378,7 +378,10 @@ int state_init(void)
state->ram_size = CONFIG_SYS_SDRAM_SIZE;
state->ram_buf = os_malloc(state->ram_size);
- assert(state->ram_buf);
+ if (!state->ram_buf) {
+ printf("Out of memory\n");
+ os_exit(1);
+ }
state_reset_for_test(state);
/*