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/memory_bus.c b/memory_bus.c
index edc48e6..7219171 100644
--- a/memory_bus.c
+++ b/memory_bus.c
@@ -69,7 +69,7 @@
 	flash->virtual_memory = (chipaddr)ERROR_PTR;
 	flash->virtual_registers = (chipaddr)ERROR_PTR;
 
-	const chipsize_t size = flash->chip->total_size * 1024;
+	const chipsize_t size = flashprog_flash_getsize(flash);
 	void *const addr = programmer_map_flash_data(par, size, flash->chip->name);
 	if (addr == ERROR_PTR)
 		return 1;
@@ -92,7 +92,7 @@
 	 * but it might be somewhere completely different on some chips and programmers,
 	 * or not mappable at all. Ignore these problems for now and always report success.
 	 */
-	const chipsize_t size = flash->chip->total_size * 1024;
+	const chipsize_t size = flashprog_flash_getsize(flash);
 	const uintptr_t base = 0xffffffff - size - 0x400000 + 1;
 	void *const addr = programmer_map_flash_region(par, "flash chip registers", base, size);
 	if (addr == ERROR_PTR) {