Fix for a bug that would show up if CONFIG_MTD_BYTE_WRITE was not selected and the SMART sector size was larger than the mtd device's block size (like it would be if using SMARTFS on larger flash devices). From Ken Pettit
This commit is contained in:
parent
9f5418e5d3
commit
f881abe2da
1 changed files with 3 additions and 1 deletions
|
|
@ -578,7 +578,9 @@ static ssize_t smart_bytewrite(struct smart_struct_s *dev, size_t offset,
|
|||
/* First calculate the start block and number of blocks affected */
|
||||
|
||||
startblock = offset / dev->geo.blocksize;
|
||||
nblocks = (nbytes + dev->geo.blocksize-1) / dev->geo.blocksize;
|
||||
nblocks = (offset - startblock * dev->geo.blocksize + nbytes +
|
||||
dev->geo.blocksize-1) / dev->geo.blocksize;
|
||||
|
||||
DEBUGASSERT(nblocks <= dev->mtdBlksPerSector);
|
||||
|
||||
/* Do a block read */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue