summaryrefslogtreecommitdiff
path: root/src/drivers/spi/adesto.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/spi/adesto.c')
-rw-r--r--src/drivers/spi/adesto.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/drivers/spi/adesto.c b/src/drivers/spi/adesto.c
index 52a74f97bd..d286bd66f6 100644
--- a/src/drivers/spi/adesto.c
+++ b/src/drivers/spi/adesto.c
@@ -93,9 +93,9 @@ static int adesto_write(const struct spi_flash *flash, u32 offset, size_t len,
u8 cmd[4];
page_size = 1 << stm->params->l2_page_size;
- byte_addr = offset % page_size;
for (actual = 0; actual < len; actual += chunk_len) {
+ byte_addr = offset % page_size;
chunk_len = min(len - actual, page_size - byte_addr);
chunk_len = spi_crop_chunk(sizeof(cmd), chunk_len);
@@ -127,7 +127,6 @@ static int adesto_write(const struct spi_flash *flash, u32 offset, size_t len,
goto out;
offset += chunk_len;
- byte_addr = 0;
}
#if CONFIG_DEBUG_SPI_FLASH