Edward O'Callaghan has uploaded this change for review.

View Change

flashrom.c: Make emergency_help_message() static local

emergency help is relevent only to that of the internal
programmer however the cli logic should be agnostic of
that.

Change-Id: Ib0d390c44e7a851e684014925a25c8b259b810cd
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
---
M cli_classic.c
M flashrom.c
M include/flash.h
3 files changed, 24 insertions(+), 11 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/74/67474/1
diff --git a/cli_classic.c b/cli_classic.c
index bac31d1..dc4a49e 100644
--- a/cli_classic.c
+++ b/cli_classic.c
@@ -1147,15 +1147,6 @@
ret = do_extract(fill_flash);
else if (erase_it) {
ret = flashrom_flash_erase(fill_flash);
- /*
- * FIXME: Do we really want the scary warning if erase failed?
- * After all, after erase the chip is either blank or partially
- * blank or it has the old contents. A blank chip won't boot,
- * so if the user wanted erase and reboots afterwards, the user
- * knows very well that booting won't work.
- */
- if (ret)
- emergency_help_message();
}
else if (write_it)
ret = do_write(fill_flash, filename, referencefile);
diff --git a/flashrom.c b/flashrom.c
index 81d3f8d..0f07e44 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -1323,7 +1323,7 @@
"https://www.flashrom.org/Contact for details), thanks!\n");
}

-void emergency_help_message(void)
+static void emergency_help_message(void)
{
msg_gerr("Your flash chip is in an unknown state.\n");
if (is_internal_programmer())
@@ -1601,6 +1601,15 @@

finalize_flash_access(flashctx);

+ /*
+ * FIXME: Do we really want the scary warning if erase failed?
+ * After all, after erase the chip is either blank or partially
+ * blank or it has the old contents. A blank chip won't boot,
+ * so if the user wanted erase and reboots afterwards, the user
+ * knows very well that booting won't work.
+ */
+ if (ret)
+ emergency_help_message();
return ret;
}

diff --git a/include/flash.h b/include/flash.h
index 79aaa64..0d2dc1b 100644
--- a/include/flash.h
+++ b/include/flash.h
@@ -417,7 +417,6 @@
int erase_flash(struct flashctx *flash);
int probe_flash(struct registered_master *mst, int startchip, struct flashctx *fill_flash, int force);
int verify_range(struct flashctx *flash, const uint8_t *cmpbuf, unsigned int start, unsigned int len);
-void emergency_help_message(void);
void print_version(void);
void print_buildinfo(void);
void print_banner(void);

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

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ib0d390c44e7a851e684014925a25c8b259b810cd
Gerrit-Change-Number: 67474
Gerrit-PatchSet: 1
Gerrit-Owner: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-MessageType: newchange