1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-27 15:12:36 +02:00

layout: Drop count parameter of flashrom_layout_new()

Change-Id: I22c180c9971068b1ae101845ce88484c6842b852
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/33544
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Nico Huber 2019-06-16 20:17:19 +02:00
parent 953c5ad440
commit 78d9c7d02c
4 changed files with 5 additions and 6 deletions

View File

@ -823,7 +823,7 @@ notfound:
return -1; return -1;
/* Fill default layout covering the whole chip. */ /* 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, flashrom_layout_add_region(flash->default_layout,
0, flash->chip->total_size * 1024 - 1, "complete flash") || 0, flash->chip->total_size * 1024 - 1, "complete flash") ||
flashrom_layout_include_region(flash->default_layout, "complete flash")) flashrom_layout_include_region(flash->default_layout, "complete flash"))

View File

@ -1279,7 +1279,7 @@ int layout_from_ich_descriptors(
return 1; return 1;
} }
if (flashrom_layout_new(layout, ARRAY_SIZE(regions))) if (flashrom_layout_new(layout))
return 2; return 2;
ssize_t i; ssize_t i;

View File

@ -34,7 +34,7 @@ static struct flashrom_layout *global_layout;
struct flashrom_layout *get_global_layout(void) struct flashrom_layout *get_global_layout(void)
{ {
if (!global_layout) if (!global_layout)
flashrom_layout_new(&global_layout, 0); flashrom_layout_new(&global_layout);
return global_layout; return global_layout;
} }
@ -378,12 +378,11 @@ const struct romentry *layout_next(
* @brief Create a new, empty layout. * @brief Create a new, empty layout.
* *
* @param layout Pointer to returned layout reference. * @param layout Pointer to returned layout reference.
* @param count Number of layout entries to allocate.
* *
* @return 0 on success, * @return 0 on success,
* 1 if out of memory. * 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)); *layout = malloc(sizeof(**layout));
if (!*layout) { if (!*layout) {

View File

@ -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); int flashrom_image_verify(struct flashrom_flashctx *, const void *buffer, size_t buffer_len);
struct flashrom_layout; 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_from_ifd(struct flashrom_layout **, struct flashrom_flashctx *, const void *dump, size_t len);
int flashrom_layout_read_fmap_from_rom(struct flashrom_layout **, int flashrom_layout_read_fmap_from_rom(struct flashrom_layout **,
struct flashrom_flashctx *, off_t offset, size_t length); struct flashrom_flashctx *, off_t offset, size_t length);