]> git.baikalelectronics.ru Git - uboot.git/commit
sandbox: Avoid using malloc() for system state
authorSimon Glass <sjg@chromium.org>
Sat, 6 Feb 2021 16:57:33 +0000 (09:57 -0700)
committerTom Rini <trini@konsulko.com>
Tue, 2 Mar 2021 20:53:37 +0000 (15:53 -0500)
commitdf71116000e61538a9d884ef1b0fb786b80c4d24
treeeb63fd70c1892db02313948293e11cb011c50e85
parentb42a17820d47d3db332bb39f39bb09096bf877ee
sandbox: Avoid using malloc() for system state

This state is not accessible to the running U-Boot but at present it is
allocated in the emulated SDRAM. This doesn't seem very useful. Adjust
it to allocate from the OS instead.

The RAM buffer is currently not freed, but should be, so add that into
state_uninit(). Update the comment for os_free() to indicate that NULL is
a valid parameter value.

Note that the strdup() in spl_board_load_image() is changed as well, since
strdup() allocates memory in the RAM buffer.

Signed-off-by: Simon Glass <sjg@chromium.org>
arch/sandbox/cpu/os.c
arch/sandbox/cpu/spl.c
arch/sandbox/cpu/start.c
arch/sandbox/cpu/state.c
include/os.h