diff --git a/common/src/lx_nor_flash_extended_cache_enable.c b/common/src/lx_nor_flash_extended_cache_enable.c index 86b3673..2b31afb 100644 --- a/common/src/lx_nor_flash_extended_cache_enable.c +++ b/common/src/lx_nor_flash_extended_cache_enable.c @@ -290,7 +290,7 @@ ULONG block_word; /* Loop through the memory supplied and assign to cache entries. */ i = 0; - while (cache_size >= LX_NOR_SECTOR_SIZE) + while ((cache_size >= LX_NOR_SECTOR_SIZE) && (i < LX_NOR_EXTENDED_CACHE_SIZE)) { /* Setup this cache entry. */ @@ -309,7 +309,7 @@ ULONG block_word; } /* Save the number of cache entries. */ - if(i > LX_NOR_EXTENDED_CACHE_SIZE) + if(i == LX_NOR_EXTENDED_CACHE_SIZE) { nor_flash -> lx_nor_flash_extended_cache_entries = LX_NOR_EXTENDED_CACHE_SIZE;