summaryrefslogtreecommitdiffstats
path: root/flashrom.c
diff options
context:
space:
mode:
authorStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>2012-12-26 19:51:23 +0000
committerStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>2012-12-26 19:51:23 +0000
commita6d96480176417478350e97338451554b5450cba (patch)
tree5414f347772370cab4297954d82cf059683f5fe5 /flashrom.c
parentb8911d6cecf5044f3e9c444e3086dd269a0279b1 (diff)
downloadast2050-flashrom-a6d96480176417478350e97338451554b5450cba.zip
ast2050-flashrom-a6d96480176417478350e97338451554b5450cba.tar.gz
Add general programmer sanity checks
And remove the completely unused vendor field. Corresponding to flashrom svn r1630. Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Diffstat (limited to 'flashrom.c')
-rw-r--r--flashrom.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/flashrom.c b/flashrom.c
index dae54f0..a55dcd8 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -1557,8 +1557,9 @@ void print_banner(void)
int selfcheck(void)
{
- int ret = 0;
const struct flashchip *chip;
+ int i;
+ int ret = 0;
/* Safety check. Instead of aborting after the first error, check
* if more errors exist.
@@ -1567,6 +1568,32 @@ int selfcheck(void)
msg_gerr("Programmer table miscompilation!\n");
ret = 1;
}
+ for (i = 0; i < PROGRAMMER_INVALID; i++) {
+ const struct programmer_entry p = programmer_table[i];
+ if (p.name == NULL) {
+ msg_gerr("All programmers need a valid name, but the one with index %d does not!\n", i);
+ ret = 1;
+ /* This might hide other problems with this programmer, but allows for better error
+ * messages below without jumping through hoops. */
+ continue;
+ }
+ if (p.init == NULL) {
+ msg_gerr("Programmer %s does not have a valid init function!\n", p.name);
+ ret = 1;
+ }
+ if (p.delay == NULL) {
+ msg_gerr("Programmer %s does not have a valid delay function!\n", p.name);
+ ret = 1;
+ }
+ if (p.map_flash_region == NULL) {
+ msg_gerr("Programmer %s does not have a valid map_flash_region function!\n", p.name);
+ ret = 1;
+ }
+ if (p.unmap_flash_region == NULL) {
+ msg_gerr("Programmer %s does not have a valid unmap_flash_region function!\n", p.name);
+ ret = 1;
+ }
+ }
/* It would be favorable if we could also check for correct termination
* of the following arrays, but we don't know their sizes in here...
* For 'flashchips' we check the first element to be non-null. In the
OpenPOWER on IntegriCloud