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/fmap.c b/fmap.c
index 0e8dd95..e8f5b5b 100644
--- a/fmap.c
+++ b/fmap.c
@@ -189,10 +189,10 @@
bool fmap_found = false;
bool check_offset_0 = true;
struct fmap *fmap;
- const unsigned int chip_size = flashctx->chip->total_size * 1024;
+ const unsigned int chip_size = flashprog_flash_getsize(flashctx);
const int sig_len = strlen(FMAP_SIGNATURE);
- if (rom_offset + len > flashctx->chip->total_size * 1024)
+ if (rom_offset + len > flashprog_flash_getsize(flashctx))
return 1;
if (len < sizeof(*fmap))