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>
diff --git a/boot/cedit.c b/boot/cedit.c
index d69290c..4e80875 100644
--- a/boot/cedit.c
+++ b/boot/cedit.c
@@ -449,8 +449,7 @@
void *fdt;
int ret;
- abuf_init(buf);
- if (!abuf_realloc(buf, CEDIT_SIZE_INC))
+ if (!abuf_init_size(buf, CEDIT_SIZE_INC))
return log_msg_ret("buf", -ENOMEM);
fdt = abuf_data(buf);