@ -130,7 +130,7 @@ static size_t spi_flash_write(struct flash_dev *dev, uint32_t addr,
spi_flash_addr(cmd, addr);
nbytes = min(len, 32);
nbytes = nbytes - ((addr + nbytes) & 0xff);
nbytes = min(nbytes, align_up(addr + 1, ilog2(256)) - addr);
memmove(cmd + 4, data, nbytes);
spi_tx_rx(spi_dev, NULL, 0, cmd, 4 + nbytes);