From 78d9c7d02c0eb9720a40d9fe80a4843c064fd3c6 Mon Sep 17 00:00:00 2001 From: Nico Huber Date: Sun, 16 Jun 2019 20:17:19 +0200 Subject: [PATCH] layout: Drop `count` parameter of flashrom_layout_new() Change-Id: I22c180c9971068b1ae101845ce88484c6842b852 Signed-off-by: Nico Huber Reviewed-on: https://review.coreboot.org/c/flashrom/+/33544 Reviewed-by: Angel Pons Reviewed-by: Anastasia Klimchuk Reviewed-by: Edward O'Callaghan Tested-by: build bot (Jenkins) --- flashrom.c | 2 +- ich_descriptors.c | 2 +- layout.c | 5 ++--- libflashrom.h | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/flashrom.c b/flashrom.c index 34cbdac84..b20e3e12f 100644 --- a/flashrom.c +++ b/flashrom.c @@ -823,7 +823,7 @@ notfound: return -1; /* Fill default layout covering the whole chip. */ - if (flashrom_layout_new(&flash->default_layout, 1) || + if (flashrom_layout_new(&flash->default_layout) || flashrom_layout_add_region(flash->default_layout, 0, flash->chip->total_size * 1024 - 1, "complete flash") || flashrom_layout_include_region(flash->default_layout, "complete flash")) diff --git a/ich_descriptors.c b/ich_descriptors.c index 5e6c7fb53..21fc40b6a 100644 --- a/ich_descriptors.c +++ b/ich_descriptors.c @@ -1279,7 +1279,7 @@ int layout_from_ich_descriptors( return 1; } - if (flashrom_layout_new(layout, ARRAY_SIZE(regions))) + if (flashrom_layout_new(layout)) return 2; ssize_t i; diff --git a/layout.c b/layout.c index 8047a93a3..e71f6a40c 100644 --- a/layout.c +++ b/layout.c @@ -34,7 +34,7 @@ static struct flashrom_layout *global_layout; struct flashrom_layout *get_global_layout(void) { if (!global_layout) - flashrom_layout_new(&global_layout, 0); + flashrom_layout_new(&global_layout); return global_layout; } @@ -378,12 +378,11 @@ const struct romentry *layout_next( * @brief Create a new, empty layout. * * @param layout Pointer to returned layout reference. - * @param count Number of layout entries to allocate. * * @return 0 on success, * 1 if out of memory. */ -int flashrom_layout_new(struct flashrom_layout **const layout, const unsigned int count) +int flashrom_layout_new(struct flashrom_layout **const layout) { *layout = malloc(sizeof(**layout)); if (!*layout) { diff --git a/libflashrom.h b/libflashrom.h index b13b3fb8d..3bd6855d7 100644 --- a/libflashrom.h +++ b/libflashrom.h @@ -106,7 +106,7 @@ int flashrom_image_write(struct flashrom_flashctx *, void *buffer, size_t buffer int flashrom_image_verify(struct flashrom_flashctx *, const void *buffer, size_t buffer_len); struct flashrom_layout; -int flashrom_layout_new(struct flashrom_layout **, unsigned int count); +int flashrom_layout_new(struct flashrom_layout **); int flashrom_layout_read_from_ifd(struct flashrom_layout **, struct flashrom_flashctx *, const void *dump, size_t len); int flashrom_layout_read_fmap_from_rom(struct flashrom_layout **, struct flashrom_flashctx *, off_t offset, size_t length);