spi: flash: correct wrap-around.
This commit is contained in:
parent
3395eb1a82
commit
159a4e83b4
1 changed files with 1 additions and 1 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue