diff options
author | Peter Stuge <peter@stuge.se> | 2008-04-28 14:47:30 +0000 |
---|---|---|
committer | Peter Stuge <peter@stuge.se> | 2008-04-28 14:47:30 +0000 |
commit | 26e08b5abea3d7b6806ed5727b93257e7ed98bf2 (patch) | |
tree | 31a31501245458bf6a66f82dc20896f83e78c107 /util | |
parent | e2271430c53d24976ec3b0869dd8993cfba6d768 (diff) |
flashrom: Handle NULL probe, erase and write function pointers in the
flashchips table. The read pointer was already checked properly.
Signed-off-by: Peter Stuge <peter@stuge.se>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3273 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'util')
-rw-r--r-- | util/flashrom/flashrom.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/util/flashrom/flashrom.c b/util/flashrom/flashrom.c index 29c3a58798..c7d0bdac0d 100644 --- a/util/flashrom/flashrom.c +++ b/util/flashrom/flashrom.c @@ -111,6 +111,11 @@ struct flashchip *probe_flash(struct flashchip *flash) } printf_debug("Probing for %s %s, %d KB: ", flash->vendor, flash->name, flash->total_size); + if (!flash->probe) { + printf_debug("failed! flashrom has no probe function for this flash chip.\n"); + flash++; + continue; + } size = flash->total_size * 1024; @@ -425,6 +430,10 @@ int main(int argc, char *argv[]) if (erase_it) { printf("Erasing flash chip\n"); + if (!flash->erase) { + fprintf(stderr, "Error: flashrom has no erase function for this flash chip.\n"); + return 1; + } flash->erase(flash); exit(0); } else if (read_it) { @@ -493,8 +502,13 @@ int main(int argc, char *argv[]) // //////////////////////////////////////////////////////////// - if (write_it) + if (write_it) { + if (!flash->write) { + fprintf(stderr, "Error: flashrom has no write function for this flash chip.\n"); + return 1; + } ret |= flash->write(flash, buf); + } if (verify_it) ret |= verify_flash(flash, buf); |