summaryrefslogtreecommitdiff
path: root/lib/of_live.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2025-05-01 07:37:01 -0600
committerSimon Glass <sjg@chromium.org>2025-05-30 09:49:31 +0100
commit97b586695cd80821455ae06ee178c6c8cf759ce6 (patch)
tree51e652168f67b87cfc9fd044079d83a2b574ba7f /lib/of_live.c
parenta619c4410956f446510749b6dc3989849616b7a0 (diff)
abuf: Add a helper for initing and allocating a buffer
This construct appears in various places. Reduce code size by adding a function for it. It inits the abuf, then allocates it to the requested size. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'lib/of_live.c')
-rw-r--r--lib/of_live.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/of_live.c b/lib/of_live.c
index c1620616513..24200b948a6 100644
--- a/lib/of_live.c
+++ b/lib/of_live.c
@@ -448,8 +448,7 @@ int of_live_flatten(const struct device_node *root, struct abuf *buf)
{
int ret;
- abuf_init(buf);
- if (!abuf_realloc(buf, BUF_STEP))
+ if (!abuf_init_size(buf, BUF_STEP))
return log_msg_ret("ini", -ENOMEM);
ret = fdt_create(abuf_data(buf), abuf_size(buf));