mirror of
https://github.com/apache/nuttx.git
synced 2026-09-20 12:58:29 +08:00
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:
+3
-1
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user