Author: stuge Date: 2008-04-28 16:47:30 +0200 (Mon, 28 Apr 2008) New Revision: 3273 Modified: trunk/util/flashrom/flashrom.c Log: 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> Modified: trunk/util/flashrom/flashrom.c =================================================================== --- trunk/util/flashrom/flashrom.c 2008-04-25 23:11:02 UTC (rev 3272) +++ trunk/util/flashrom/flashrom.c 2008-04-28 14:47:30 UTC (rev 3273) @@ -111,6 +111,11 @@ } 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 @@ 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 @@ // //////////////////////////////////////////////////////////// - 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);
participants (1)
-
svn@coreboot.org