mirror of
https://github.com/u-boot/u-boot.git
synced 2025-01-10 04:43:47 +08:00
cli: panic when failed to allocate memory for the history buffer
This commit simply modifies the history initialize function, replacing the return value by panic with reasons. The calling chains of hist_init don't have steps explicitly throwing or dealing with the ENOMEM error, and once the init fails, the whole system is died. Using panic here to provide error information instead. Signed-off-by: Hanyuan Zhao <hanyuan-z@qq.com>
This commit is contained in:
parent
efdf91c8ea
commit
4495134030
@ -110,7 +110,7 @@ static int hist_init(void)
|
||||
|
||||
hist = calloc(HIST_MAX, HIST_SIZE + 1);
|
||||
if (!hist)
|
||||
return -ENOMEM;
|
||||
panic("%s: calloc: out of memory!\n", __func__);
|
||||
|
||||
for (i = 0; i < HIST_MAX; i++)
|
||||
hist_list[i] = hist + (i * (HIST_SIZE + 1));
|
||||
|
Loading…
Reference in New Issue
Block a user