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/spi25.c b/spi25.c
index a628770..e5a9ddb 100644
--- a/spi25.c
+++ b/spi25.c
@@ -563,7 +563,7 @@
int spi_block_erase_60(struct flashctx *flash, unsigned int addr,
unsigned int blocklen)
{
- if ((addr != 0) || (blocklen != flash->chip->total_size * 1024)) {
+ if ((addr != 0) || (blocklen != flashprog_flash_getsize(flash))) {
msg_cerr("%s called with incorrect arguments\n",
__func__);
return -1;
@@ -573,7 +573,7 @@
int spi_block_erase_62(struct flashctx *flash, unsigned int addr, unsigned int blocklen)
{
- if ((addr != 0) || (blocklen != flash->chip->total_size * 1024)) {
+ if ((addr != 0) || (blocklen != flashprog_flash_getsize(flash))) {
msg_cerr("%s called with incorrect arguments\n",
__func__);
return -1;
@@ -584,7 +584,7 @@
int spi_block_erase_c7(struct flashctx *flash, unsigned int addr,
unsigned int blocklen)
{
- if ((addr != 0) || (blocklen != flash->chip->total_size * 1024)) {
+ if ((addr != 0) || (blocklen != flashprog_flash_getsize(flash))) {
msg_cerr("%s called with incorrect arguments\n",
__func__);
return -1;