Skip to content

Commit cfbfd53

Browse files
authored
Merge pull request adafruit#8235 from elpekenin/fix/stm32-cache-skip
Redo of adafruit#8228
2 parents aecaab7 + 1ece85e commit cfbfd53

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

ports/stm/supervisor/internal_flash.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,9 +303,8 @@ mp_uint_t supervisor_flash_read_blocks(uint8_t *dest, uint32_t block, uint32_t n
303303
flash_get_sector_info(src, &sector_start_addr, &sector_size);
304304
// Count how many blocks are left in the sector
305305
uint32_t count = (sector_size - (src - sector_start_addr)) / FILESYSTEM_BLOCK_SIZE;
306-
count = MIN(num_blocks, count);
307306

308-
if (count < num_blocks && _cache_flash_addr == sector_start_addr) {
307+
if (count <= num_blocks && _cache_flash_addr == sector_start_addr) {
309308
// Read is contained in the cache, so just read cache
310309
memcpy(dest, (_flash_cache + (src - sector_start_addr)), FILESYSTEM_BLOCK_SIZE * num_blocks);
311310
} else {

0 commit comments

Comments
 (0)