Am 28.12.2011 01:57 schrieb Stefan Tauner:
Signed-off-by: Stefan Tauner stefan.tauner@student.tuwien.ac.at
Sorry, Nack.
Quoting from your other mail:
it is easier to "upcast" some flashctx "objects" to flashchip (which is safe)
AFAICS this violates the C standard. http://stackoverflow.com/questions/98650/what-is-the-strict-aliasing-rule
The offending hunks are below:
diff --git a/flashrom.c b/flashrom.c index f1a6165..68b6d97 100644 --- a/flashrom.c +++ b/flashrom.c @@ -1313,7 +1313,7 @@ int erase_and_write_flash(struct flashctx *flash, uint8_t *oldcontents, int k, ret = 1; uint8_t *curcontents; unsigned long size = flash->total_size * 1024;
- unsigned int usable_erasefunctions = count_usable_erasers(flash);
unsigned int usable_erasefunctions = count_usable_erasers((struct flashchip*) flash);
msg_cinfo("Erasing and writing flash chip... "); curcontents = malloc(size);
@@ -1332,7 +1332,7 @@ int erase_and_write_flash(struct flashctx *flash, uint8_t *oldcontents, break; } msg_cdbg("Trying erase function %i... ", k);
if (check_block_eraser(flash, k, 1))
usable_erasefunctions--; ret = walk_eraseregions(flash, k, &erase_and_write_block_helper,if (check_block_eraser((struct flashchip*) flash, k, 1)) continue;
@@ -1680,7 +1680,7 @@ int doit(struct flashctx *flash, int force, const char *filename, int read_it, int ret = 0; unsigned long size = flash->total_size * 1024;
- if (chip_safety_check(flash, force, read_it, write_it, erase_it, verify_it)) {
- if (chip_safety_check((struct flashchip*) flash, force, read_it, write_it, erase_it, verify_it)) { msg_cerr("Aborting.\n"); ret = 1; goto out_nofree;