Felix Singer submitted this change.

View Change


Approvals: build bot (Jenkins): Verified Felix Singer: Looks good to me, approved Angel Pons: Looks good to me, approved
flashrom.c: Separate out default layout init

get_default_layout() is undefined without a
init_default_layout() so separate out that logic
from probe_flash().

Change-Id: I8fd0af8fb1c32dc9f2b00cc39b518d2f4d98e3ac
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/68296
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Singer <felixsinger@posteo.net>
---
M flashrom.c
1 file changed, 31 insertions(+), 6 deletions(-)

diff --git a/flashrom.c b/flashrom.c
index 088d804..3575822 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -761,6 +761,17 @@
return ret;
}

+static int init_default_layout(struct flashctx *flash)
+{
+ /* Fill default layout covering the whole chip. */
+ 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"))
+ return -1;
+ return 0;
+}
+
int probe_flash(struct registered_master *mst, int startchip, struct flashctx *flash, int force)
{
const struct flashchip *chip;
@@ -849,12 +860,8 @@
if (!flash->chip)
return -1;

- /* Fill default layout covering the whole chip. */
- 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"))
- return -1;
+ if (init_default_layout(flash) < 0)
+ return -1;

tmp = flashbuses_to_text(flash->chip->bustype);
msg_cinfo("%s %s flash chip \"%s\" (%d kB, %s) ", force ? "Assuming" : "Found",

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

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I8fd0af8fb1c32dc9f2b00cc39b518d2f4d98e3ac
Gerrit-Change-Number: 68296
Gerrit-PatchSet: 4
Gerrit-Owner: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus@gmail.com>
Gerrit-Reviewer: Felix Singer <felixsinger@posteo.net>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-CC: Nikolai Artemiev <nartemiev@google.com>
Gerrit-CC: Thomas Heijligen <src@posteo.de>
Gerrit-MessageType: merged