Use flashprog_flash_getsize() where possible
Change-Id: I4eab12dc9dcf0c7fdffc5c662081868c6f32e36c
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/493
diff --git a/82802ab.c b/82802ab.c
index 0af5d28..3dc48c0 100644
--- a/82802ab.c
+++ b/82802ab.c
@@ -213,7 +213,7 @@
}
/* Read block lock-bits */
- for (i = 0; i < flash->chip->total_size * 1024; i+= (64 * 1024)) {
+ for (i = 0; i < flashprog_flash_getsize(flash); i+= (64 * 1024)) {
bcfg = chip_readb(flash, bios + i + 2); // read block lock config
msg_cdbg("block lock at %06x is %slocked!\n", i, bcfg ? "" : "un");
if (bcfg) {
@@ -266,7 +266,7 @@
}
/* Read block lock-bits, 8 * 8 KB + 15 * 64 KB */
- for (i = 0; i < flash->chip->total_size * 1024;
+ for (i = 0; i < flashprog_flash_getsize(flash);
i += (i >= (64 * 1024) ? 64 * 1024 : 8 * 1024)) {
bcfg = chip_readb(flash, bios + i + 2); /* read block lock config */
msg_cdbg("block lock at %06x is %slocked!\n", i,