1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

drivers/mtd_mci: fix sub-page writes

When doing sub-page writes, we would return a value that is larger
than the amount of bytes written, causing an underflow in the MTD layer.
This commit is contained in:
Benjamin Valentin 2022-03-21 11:52:17 +01:00 committed by Benjamin Valentin
parent ce1ec91adc
commit 2f7cf35173

View File

@ -111,7 +111,7 @@ static int mtd_mci_write_page(mtd_dev_t *dev, const void *buff, uint32_t page,
return -EIO;
}
return pages * SD_HC_BLOCK_SIZE;
return min(size, pages * SD_HC_BLOCK_SIZE);
}
static int mtd_mci_erase_sector(mtd_dev_t *dev, uint32_t sector, uint32_t count)