Nico Huber would like Angel Pons, Arthur Heymans, David Hendricks and Thomas Heijligen to review this change.

View Change

layout: Drop `count` parameter of flashrom_layout_empty()

Change-Id: I22c180c9971068b1ae101845ce88484c6842b852
Signed-off-by: Nico Huber <nico.h@gmx.de>
---
M flashrom.c
M ich_descriptors.c
M layout.c
M libflashrom.h
4 files changed, 5 insertions(+), 6 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/44/33544/1
diff --git a/flashrom.c b/flashrom.c
index cb91cef..eeaa067 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -1332,7 +1332,7 @@
return -1;

/* Fill default layout covering the whole chip. */
- if (flashrom_layout_empty(&flash->default_layout, 1) ||
+ if (flashrom_layout_empty(&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 8383801..1d35cca 100644
--- a/ich_descriptors.c
+++ b/ich_descriptors.c
@@ -1170,7 +1170,7 @@
if (read_ich_descriptors_from_dump(dump, len, &cs, &desc))
return 1;

- if (flashrom_layout_empty(layout, ARRAY_SIZE(regions)))
+ if (flashrom_layout_empty(layout))
return 2;

ssize_t i;
diff --git a/layout.c b/layout.c
index 3560a18..9d633bb 100644
--- a/layout.c
+++ b/layout.c
@@ -33,7 +33,7 @@
struct flashrom_layout *get_global_layout(void)
{
if (!global_layout)
- flashrom_layout_empty(&global_layout, 0);
+ flashrom_layout_empty(&global_layout);
return global_layout;
}

@@ -264,12 +264,11 @@
* @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_empty(struct flashrom_layout **const layout, const unsigned int count)
+int flashrom_layout_empty(struct flashrom_layout **layout)
{
*layout = malloc(sizeof(**layout));
if (!*layout) {
diff --git a/libflashrom.h b/libflashrom.h
index 90f3e2c..785217e 100644
--- a/libflashrom.h
+++ b/libflashrom.h
@@ -62,7 +62,7 @@
int flashrom_image_verify(struct flashrom_flashctx *, const void *buffer, size_t buffer_len);

struct flashrom_layout;
-int flashrom_layout_empty(struct flashrom_layout **layout, unsigned int count);
+int flashrom_layout_empty(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);

To view, visit change 33544. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I22c180c9971068b1ae101845ce88484c6842b852
Gerrit-Change-Number: 33544
Gerrit-PatchSet: 1
Gerrit-Owner: Nico Huber <nico.h@gmx.de>
Gerrit-Reviewer: Angel Pons <th3fanbus@gmail.com>
Gerrit-Reviewer: Arthur Heymans <arthur@aheymans.xyz>
Gerrit-Reviewer: David Hendricks <david.hendricks@gmail.com>
Gerrit-Reviewer: Thomas Heijligen <src@posteo.de>
Gerrit-MessageType: newchange